Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 turn on line numbering for nano?

share|improve this question
up vote 10 down vote accepted

The only thing coming close to what you want is option to display your current cursor position. You activate it by using --const (manpage: Constantly show the cursor position) option or by pressing AltC on an open text file.

share|improve this answer
Good answer. The --const argument is the same as -c. Use it to open the file like this: nano -c filename . Also, to make it permanent, include the 'set const' option in your ~/.nanorc file, which may not exist until you create it. – MountainX Feb 2 '12 at 2:24

Nano is by design a very simple editor with few features. If you start wishing for anything beyond basic edition, nano isn't the right tool. Emacs is a very powerful editor; to switch line numbers on, type M-x linum-mode. If Emacs scares you and you want a text mode editor, consider Joe, where line numbers are switched on with the -linums option.

share|improve this answer

Not in the main Nano, so I wrote a fork that includes it. To enable it just put "set linenumbers" (or "set hexlinenumbers" for hex) in your .nanorc https://github.com/faissaloo/l-nano
Example of line numbering

share|improve this answer

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.