Once you have connected to your Linux ssh account, you will need to access a text editor to write the code. There are a few already installed on the system (vi, emacs, etc.), but these have a bit of a learning curve associated with them. Nano is a relatively easy editor to use, but you have to operate it entirely from the keyboard, so you'll have to learn some keyboard commands. Fortunately, they're pretty quick and easy to learn!
NOTE: Any command prefixed with a caret symbol (^) means to use the Ctrl key (e.g., ^G means to press the Ctrl+g keys at the same time). Any command prefixed with the letter M means to press the Alt key (e.g., M-R means to press the Alt+r keys together)..
Nano Keyboard Commands
If you take a look at the online help in nano (Ctrl+G) you'll be presented with a list of the commands available. For your convenience, I've duplicated that list below; the ones I think are most important are marked with three asterisks.
NOTE: Any command prefixed with a caret symbol (^) means to use the Ctrl key (e.g., ^G means to press the Ctrl+G keys at the same time). Any command prefixed with the letter M means to press the Alt key (e.g., M-R means to press the Alt+R keys together).
Most Helpful! |
Ctrl Key Combination |
Function Key |
Alt Key Combination |
Description |
*** |
^G |
F1 |
|
Display the help text |
*** |
^X |
F2 |
|
Close the current file buffer / Exit from nano |
*** |
^O |
F3 |
|
Write the current file to disk |
|
^J |
F4 |
|
Justify the current paragraph |
|
^R |
F5 |
|
Insert another file into the current one |
*** |
^W |
F6 |
|
Search for a string or a regular expression |
*** |
^Y |
F7 |
|
Move to the previous screen |
*** |
^V |
F8 |
|
Move to the next screen |
*** |
^K |
F9 |
|
Cut the current line and store it in the cutbuffer |
*** |
^U |
F10 |
|
Uncut from the cutbuffer into the current line |
*** |
^C |
F11 |
|
Display the position of the cursor |
|
^T |
F12 |
|
Invoke the spell checker, if available |
*** |
^_ |
F13 |
M-G |
Go to line and column number |
*** |
^\ |
F14 |
M-R |
Replace a string or a regular expression |
|
^^ |
F15 |
M-A |
Mark text at the cursor position |
*** |
|
F16 |
M-W |
Repeat last search |
*** |
|
|
M-^ or M-6 |
Copy the current line and store it in the cutbuffer |
|
|
|
M-} |
Indent the current line |
|
|
|
M-{ |
Unindent the current line |
|
^F |
|
|
Move forward one character |
|
^B |
|
|
Move back one character |
|
^Space |
|
|
Move forward one word |
|
|
|
M-Space |
Move back one word |
*** |
^P |
|
|
Move to the previous line |
*** |
^N |
|
|
Move to the next line |
*** |
^A |
|
|
Move to the beginning of the current line |
*** |
^E |
|
|
Move to the end of the current line |
|
|
|
M-( or M-9 |
Move to the beginning of the current paragraph |
|
|
|
M-) or M-0 |
Move to the end of the current paragraph |
|
|
|
M-\ or M-| |
Move to the first line of the file |
|
|
|
M-/ or M-? |
Move to the last line of the file |
*** |
|
|
M-] |
Move to the matching bracket |
|
|
|
M-- or M-_ |
Scroll up one line without scrolling the cursor |
|
|
|
M-+ or M-= |
Scroll down one line without scrolling the cursor |
*** |
|
|
M-< or M-, |
Switch to the previous file buffer |
*** |
|
|
M-> or M-. |
Switch to the next file buffer |
|
|
|
M-V |
Insert the next keystroke verbatim |
|
^I |
|
|
Insert a tab at the cursor position |
|
^M |
|
|
Insert a newline at the cursor position |
|
^D |
|
|
Delete the character under the cursor |
|
^H |
|
|
Delete the character to the left of the cursor |
|
|
|
M-T |
Cut from the cursor position to the end of the file |
|
|
|
M-J |
Justify the entire file |
|
|
|
M-D |
Count the number of words, lines, and characters |
*** |
^L |
|
|
Refresh (redraw) the current screen |
|
|
|
M-X |
Help mode enable/disable |
*** |
|
|
M-C |
Constant cursor position display enable/disable |
|
|
|
M-O |
Use of one more line for editing enable/disable |
|
|
|
M-S |
Smooth scrolling enable/disable |
|
|
|
M-P |
Whitespace display enable/disable |
|
|
|
M-Y |
Color syntax highlighting enable/disable |
|
|
|
M-H |
Smart home key enable/disable |
*** |
|
|
M-I |
Auto indent enable/disable |
|
|
|
M-K |
Cut to end enable/disable |
|
|
|
M-L |
Long line wrapping enable/disable |
|
|
|
M-Q |
Conversion of typed tabs to spaces enable/disable |
|
|
|
M-B |
Backup files enable/disable |
|
|
|
M-F |
Multiple file buffers enable/disable |
|
|
|
M-M |
Mouse support enable/disable |
|
|
|
M-N |
No conversion from DOS/Mac format enable/disable |
|
|
|
M-Z |
Suspension enable/disable |