text editing

How to use Nano on Unix-like systems

Nano is a basic text only text editor in Unix. It has no real GUI as such, and there is very little mouse interaction. But this makes it very useful, especially when SSHing to your web server. Here are some basic commands for you.

Opening Nano to edit a file is as simple as

Nano filepath/filename &

Note the & on the end to tell Terminal to carry on and not wait.

Key Shortcuts

With all these key shortcuts, the shortcut is called by holding CTRL and pressing the shortcut key:

Moving around the file:

CTRL + A -> Move the cursor to the start of the line.
CTRL + E -> Move to the end of the line.
CTRL + Y -> Page Down.
CTRL + V -> Page Up.
CTRL + _ -> Move to a specific line/column.

The mouse wheel on my Ubuntu will move the cursor up and down. I don’t know if this is design or just luck.

Editing the file:

CTRL + K -> Cut the whole line the cursor is on. (Similar to deleting, however you can re-paste these – see below)
DELETE -> Deletes the character ahead of the cursor (as you’d expect).
BACKSPACE -> This deletes the character before the cursor (again, as expected).

Copy and Paste:

ALT + 6 will copy a line into the copy buffer. You may copy more multiple lines into the buffer, and when you paste them, they will paste in the order that you coped them.
CTRL + K to cut a line

CTRL + U will paste what ever is in the buffer. As mentioned before, if you copy multiple lines, they will be pasted in the order that you copied them. Neat.


CTRL + O -> Save the current file. You will be prompted for the filename which will default to the current file.
CTRL + X -> This will quit the application. However, if the file has changed, you will be prompted if you want to save changes.
CTRL + T -> When performing file actions, CTRL+T will show you a basic file browser…


CTRL + G -> This will show the full Nano help file with many more commands.