Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to tell nano to automatically show line numbering each time I open a file.

share|improve this question

2 Answers 2

up vote 57 down vote accepted

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 const

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.

share|improve this answer
    
If you are in a tty, an alternative to CTRL+C is F11 and an alternative to ALT+G is F13 (which doesn't exist on my keyboard) or Ctrl+_ (Ctrl+Shift+-). –  Radu Rădeanu Jun 3 at 12:15

If nano -c filename does not work, use nano filename then Ctrl +_. It will ask you for the line number to go to.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.