Get the App
SLTechnology News&Howtos  ›  Development  › 

How to add line number in Linux system vi

Shulou Source: shulou.com Published: 2022-06-01 20:23:57 10月02日 Update

This article mainly introduces the Linux system vi how to add line numbers, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Method 1: 1. Display the current line number and enter it in VI command mode

: nu

2. Display all line numbers and enter them in VI command mode

: set nu

Method 2: edit the ~ / .vimrc file using vi, add a line "set nu" to the file, and add the content without quotation marks. The command is as follows:

Maybe this file doesn't exist, just create a new one and add set nu to it.

Method 3: the configuration file of vi in UBUNTU is stored in the / etc/vim directory, the configuration file named vimrc vi in Fedora is stored in the / etc directory, and the configuration file is named vimrc

Edit the file using vi and add a line set nu to the file

Thank you for reading this article carefully. I hope the article "how to add a line number in Linux system vi" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: File article configuration line number command method system line pattern directory Chinese plus input value interest content at the same time quotation marks more friends knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn Apple MySQL Shulou Technology