List of content you will read in this article:
Two of the most powerful and commonly used command-line editors are Vim and Emacs. When using the command line, it is normal to create and update text files. Both have a steep learning curve that new users can find intimidating. Nano is a simple editor for those who do not know how to use Vim or Emacs. Nano is the most simple text editor for Linux that is command-line based. It includes all of the usual text editor functionality, such as syntax highlighting, multiple buffers, search and replacements with regular expression support, typo correction, and UTF-8 encoding.
How to Display Line Numbers in Nano
There are three methods to display line number in nano, and they are as follows:
You can directly use the following command to display line numbers in Nano:
In the above command, you need to write your file's name instead of [filename].
You can press Alt and # or Alt, Shift, and 3 key combinations to display line numbers quickly.
You can compile Nano from the scratch:
git clone git://git.savannah.gnu.org/nano.git;cd nano;./autogen.sh;./configure;sudo make install
Then, in your /.nanorc file, add the following:
# include all the preexisting configs
Using any of the three methods, you can easily set line numbers in your nano editor. Line numbers are important for users to get references on which line they are working on. Enabling them will help them understand and find an error in any of the lines.