0% found this document useful (0 votes)
328 views

Nano Command in Linux

Nano is a simple text editor that can be accessed through the terminal. It includes basic text editing functionality like search, spellcheck, and syntax highlighting. To open a file with nano, use the command "nano FILE" and navigate the file with arrow keys. Shortcuts at the bottom allow editing, saving with Ctrl+O, and exiting with Ctrl+X. Searching uses Ctrl-W and replacing uses Ctrl+\. Spellcheck must be enabled in the /etc/nanorc configuration file.

Uploaded by

Rohan shetye
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
328 views

Nano Command in Linux

Nano is a simple text editor that can be accessed through the terminal. It includes basic text editing functionality like search, spellcheck, and syntax highlighting. To open a file with nano, use the command "nano FILE" and navigate the file with arrow keys. Shortcuts at the bottom allow editing, saving with Ctrl+O, and exiting with Ctrl+X. Searching uses Ctrl-W and replacing uses Ctrl+\. Spellcheck must be enabled in the /etc/nanorc configuration file.

Uploaded by

Rohan shetye
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Nano

Nano
Nano is a simple text editor that we can access right
from the terminal. It's far more accessible than other
popular command-line editors like vim and emacs.

Nano includes all the basic text editing functionality


you would expect: search, spellcheck, syntax
highlighting, etc.
Nano
To open up a file using nano, run nano FILE. For
example, to open up the file book.txt using nano, we
would run nano book.txt
❯ nano FILE
We can also use the same command to edit a file that
doesn't yet exist (we can then save it and create the
file).
Edit At A
Specific Line
We can also provide nano with a specific line number
to position the cursor at using nano +LINE FILE. ❯ nano +LINE FILE

To open up the book.txt file at line 205, we would run


nano +205 book.txt
Editing With Nano
Some editors like vim require us to enter "write mode"
before we can start editing a file, but with nano we can
make changes right away.

We can move the cursor using the arrow keys.

At the very bottom, we'll see a list of shortcuts that we


can use inside of nano. These are super useful!
Saving
To save, we need to "write out" using the Ctrl+O
command. Then, nano will prompt us to enter the
filename we want use (just hit enter to keep the
original name).
Exiting
To exit, use ctrl + X
Searching
Use ctrl-W and then enter a search phrase
to search FORWARD in the file from your
current cursor location.
Replacing
To search and replace, use ctrl+\ and then
enter the word you want to replace. Then
enter the replacement and decide whether
to replace specific matches or all matches.
Spellchecking
We can use spellchecking inside of Nano, but
we have to enable it first in the Nano config
file located at /etc/nanorc

You might also like