Using the nano Text Editor
nano is a simple text editor that works like most desktop editors: you just start typing. It is installed on Ubuntu and many other systems, and is a good choice if you only need to change a setting now and then.
Opening files
nano file.txtOpens file.txt, or starts a new file with that name.
sudo nano /etc/hostsOpens a system file. You need sudo to save changes to files outside your home directory.
nano -l config.confShows line numbers down the side.
Using nano
The shortcuts are listed at the bottom of the screen. ^ means the Ctrl key and M- means the Alt key.
| Key | What it does |
|---|---|
Ctrl + O | Save (write out). Press Enter to confirm the name |
Ctrl + X | Exit. You'll be asked to save if there are changes |
Ctrl + W | Search |
Ctrl + \ | Search and replace |
Ctrl + K | Cut the current line |
Ctrl + U | Paste |
Ctrl + _ | Go to a line number |
Alt + U | Undo |
Ctrl + G | Help |