Line Numbers in Nano Text Editor

Nano – Show Line Numbers

I don’t frequently need to display line numbers in Nano text editor, making it easy to forget how to do this. But once in a while an error will point me to a specific line of a configuration file. This is when I suddenly struggle to remember how to enable this feature in the Nano text editor. There are surprisingly a few different ways to do this, including from the command line when you first open Nano. However the following is the easiest way for me.

Nano line numbers - Show line numbers in nano text editor
Nano line numbers

There are many command line Linux text editors. Nano is hands down my absolute favorite of the bunch. It is the easiest to use and packs a surprising number of features, including the ability to show line numbers.

Install Nano If You Don’t Already Have It

Before you can display line numbers in Nano text editor you will need to have it installed on your PC. It often comes preinstalled on Debian, Ubuntu, and their derivatives. If you don’t already have Nano installed on your Linux PC you can install it with the following command.

Debian/Ubuntu
sudo apt install nano

CentOS/Fedora
yum install nano

How To Display Line Numbers In Nano Text Editor?

To display line numbers continuously along the left side of the Nano text editor press these at the same time while the Nano window is open.
Alt-Shift-3

Alternatively you can briefly show the current line number the cursor is on. Press the following at the same time while the Nano editor is open. On the bottom of the screen you will see line, column, and character data for the location of the cursor.
control-C

Conclusion

The Nano text editor is one of the easiest Linux text editors to use, with a more subtle learning curve for beginners. Nano is fully featured including the ability to show line numbers. Full documentation for Nano. If you are a new Linux user you will want to keep my Linux Commands Cheat Sheet handy for referencing common Linux commands.

Leave a Reply

Your email address will not be published. Required fields are marked *