Nano Show Line Numbers

The Nano Editor is the most famous text editor for the console after vi/vim. What makes it popular is the ease of use.

By default you will not see a gutter area with line numbers when you open a file with Nano, there are multiple ways in which we can enable line numbers in Nano, let's take a look at a few of them.

Using the --linenumbers or -l flag

    When you open a file, just add --linenumbers to it.

    nano --linenumbers datafile.txt


    nano -l datafile.txt
    nano show line numbers example
    Line numbers as displayed in Nano Editor

Toggle Line Numbers

    If you have already opened a file using nano, and you want to display the line numbers, then you can toggle line numbers as follows,

    On macOS

     Esc + n

    On Windows

    Alt + Shift + 3
    Alt + #
    Press Escape N on macOS to Toggle Line Numbers

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap