How to Use Nano command Line Text Editor in Ubuntu Linux

business 4068346 640
business 4068346 640

The nano command is an easy-to-use command line text editor for Linux systems.

There are many command-line text editors available to Linux users. however, nano has become the default because it is easy to learn and manage.

If you’re a new user or student planning on learning how to use and manage Linux systems, the easiest place to start might be on Ubuntu Linux OS.

Ubuntu is an open-source Linux operating system that runs on desktops, laptops, servers, and other devices.

When you’re ready to learn how to use the nano commands, follow the guide below:

About nano command:

The nano command is an easy-to-use command line text editor for Linux systems. It is included on all Linux operating systems, including Ubuntu, and comes with all the basic functionality of a regular text editor.

In the same way, you use your mouse and keyboard to view or edit files with Notepad or Notepad++ on your desktop, nano is the way to do it on the command line.


The syntax is the rule and format of how the nano command can be used. These syntax options can be reordered, but a straight format must be followed.,.

Below is an example syntax of how to use the nano command.



The command line options are switches or flags that determined how the commands are executed or controlled. they modify the behavior of the commands. they are separated by spaces and followed after the commands.

Below are some options for the nano command:

   FILES.Replace FILES.. with the files you wish to edit.
-A, –smarthome
Use the -a or –all to Enable smart home key
-B –backupUse the –B or –backup to Save backups of existing files
-g, –showcursorUse the -g or –showcursor to Show cursor in file browser
-R, –restrictedUse the -R or –restricted to enable Restricted mode
-L, –nonewlinesUse the -L or –nonewlines Don’t add newlines to the ends of files
–helpDisplay a help message and exit.


Below are some examples of how to run and use the nano on Ubuntu Linux.

If you want to view an existing file or create a new file that’s not already there, you run the commands below:

If filename.txt isn’t an existing file at that location, a new file will be opened. when you save your changes, a file will be created.

nano filename.txt

This will open a new editor window when you can begin editing the file.

Nano Ubuntu Command

At the bottom of the editor windows are basic shortcuts you can use save, replace and spell check using nano editor.

If you open an existing file and want to search for a particular text and go to it, you use the command shortcut below:

ctrl + w

They type in the search term you’re searching for and press Enter. The cursor will move to the first match text in the file. To move the next match, you type the command shortcut below:

alt + w

If you’re not logged in as root or don’t have write access to the file you wish to edit, then run sudo with the nano command on the file that requires root access.

sudo nano filename.txt

To save the changes you’ve made to a file, type the shortcut below:

Ctrl + o

If the file you changed doesn’t exist, it will be created once you save it.

If you want to exit nano, type the shortcut below:

Ctrl + x

If the changes you made to a file are now saved before exiting, you’ll be asked whether you want to save the changes.

When you run nano with the –help option, you’ll see the help text below:

Usage: nano [OPTIONS] [[+LINE[,COLUMN]] FILE].

To place the cursor on a specific line of a file, put the line number with
a '+' before the filename.  The column number can be added after a comma.
When a filename is '-', nano reads data from standard input.

Option		GNU long option		Meaning
 -A		--smarthome		Enable smart home key
 -B		--backup		Save backups of existing files
 -D		--boldtext		Use bold instead of

That’s it!

Congratulations! You’ve learned how to use the nano command text editor to view and create files.

Posted by
Richard W

I love computers; maybe way too much. What I learned I try to share at

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: