How to show line numbering in nano when opening a file

The keyboard combination to display the current line number whilst you are using nano is CTRL+C.

Alternatively, to display the line & column number position you could just use the -c parameter when launching nano i.e:

nano -c [filename]

To make this permanent, nano uses a configuration in your home folder ~/.nanorc

Thus to display line numbers always when using nano...

nano ~/.nanorc

(don't worry if its empty - this file doesn't exist by default)

type set constantshow

N.B. the deprecated syntax set const is shown in the animation

Save

enter image description here


animation1

Since you are using line numbers remember you can use ALT+G to jump to a specific line number.


Accidentally found nice shortcut: Alt+#, which in some keyboard layouts can be done with Alt+Shift+3.

click me gently


Compile Nano from source:

git clone git://git.savannah.gnu.org/nano.git;cd nano;./autogen.sh;./configure;sudo make install 

Then add the following to your .nanorc file:

set linenumbers

You can use Meta+# to turn line numbers on and off from within Nano.

Tags:

Nano