Command line: editing files

When you are working on the command line, sooner or later you are going to want to edit a file through the terminal. If you are working on a remote computer, you won’t be able to use Word or some other graphical editor.

If you are new, the editor to use is called nano:

You start the editor like other commands, by writing nano <your filename>.

These commands are executed by pressing down the control key and typing the key indicated. The commands are named, er, a little strangely, and so I’ve written what might be a more familiar name in parentheses:

^G Get Help
^X Exit (quit)

^O WriteOut (save)
^J Justify (wrap line)

^R Read File (open a file)
^W Where Is (search)

^Y Prev Page (move up)
^V Next Page (move down)

^K Cut Text (cut a whole line)
^U UnCut Text (paste)

^C Cur Pos (display where you are in the file)
^T To Spell (spell check)

How-To Geek has a nice beginner’s tutorial on using nano. If you outgrow nano, most folks end up using one of two very powerful editors: vim or emacs. They are just fantastic.

Edit this page on GitHub

brought to you by