Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 146 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


enter image description here


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 '14 at 12:15

I also had this issue and eventually I just wrote a fork of nano that provides a line numbering 'ruler'. To enable it just put set linenumbers in your .nanorc

If you need your line numbers in hexadecimal use "set hexlinenumbers".

Here's an example of its line numbering

share|improve this answer
Actually like that. See you did 2 commits, was the 2nd one, (size increase..) because of the 1st one? – doug Jul 4 at 23:10
Yes, that was because of the first one. – faissaloo Jul 5 at 17:42

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

If you have already opened the file with nano you press


(not simultaneusly, press control and w, then without letting go control and letting go w, press t)

This command will require column and line, you enter them this way:

10,23 (enter)

and you will end up in line 10 character 23.

If you are at the top of the file and you only want to find the line:

Ctrl+w+t and then 10

If you are at a acertain line and you want to find the column:

Ctrl+w+t and then ,23

If you haven't opened the file yet, you can do this:

nano +10,23 file (enter)

and the file will open with cursor in the line 10, chanracter 23, so you can try also:

nano +10 file (enter)

nano +,23 file (enter) (Note that this will send you to the character 23 of the first line only)

share|improve this answer
This may be the correct way to find the line in the terminal however it does not answer the question on how to make it automatically show on opening. – DnrDevil Jan 27 at 21:10

Your Answer


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.