Languages
[Edit]
EN

Linux - enable line numbers in nano editor

7 points
Created by:
Teilsa
1345

In this short article we would like to show how to enable line numbers in nano editor under Linux.

Quick solution:

nano -l /path/to/file

Where: -l option displays line numbers in the editor (it is shortcut for --linenumbers option).

 

Screenshot:

Enabled line numbers in nano editor.
Enabled line numbers in nano editor.

Global configuration

In this section you can find simple way to turn on line numbers in nano editor for entire operating system.

Simple steps:

  1. open or create the /etc/nanorc file, e.g.
    nano /etc/nanorc
  2. find and uncomment the following line:
    set linenumbers
  3. save introduced changes.

 

User configuration

In this section you can find simple way to turn on line numbers in nano editor only for the current user.

Simple steps:

  1. open or create the ~/.nanorc file, e.g.
    nano ~/.nanorc
  2. add the following line:
    set linenumbers
  3. save introduced changes.

 

References

  1. nano manual - Homepage
  2. nano manual - Linux Command
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join