At some point you may need to create or edit a file. To do so from the terminal you need to use a command line editor. The following is three of the most widely used command line editors.
nano
nano is the simplest of the three editors and does not have a steep learning curve. nano is best used for basic tasks such as writing text files. Commands for nano are displayed at the bottom of the editing screen so you will not have to remember them.
vim
vim is more difficult to learn and use than nano, but includes the benefit of syntax highlighting which is very useful when writing code. vim will require some effort to become proficient in, but is worth it for it's efficiency. A full tutorial on vim can be found here, since it is already installed start with Getting Familiar. Interactive tutorials can be found online, simply search for them.
emacs
In a basic sense, emacs is similar to vim in that it is more advanced than Nano and provides benefits such as syntax highlighting. Reasons to choose vim over emacs or visa versa are an advanced topic and depend on the needs of the user. There are many emacs tutorials on the internet here is one (emacs is already installed, so be sure to skip that part)
Basics to Text Editors
Action | nano | vim | emacs |
---|---|---|---|
To Open |
nano filename.fileExtension |
vim filename.fileExtension |
emacs filename.fileExtension |
To Edit Text | Start typing and navigate with arrow keys | Hit i key to enter 'insert mode' then start typing and navigate with arrow keys |
Start typing and navigate with arrow keys |
To Save |
1. ^O (^ common notation for Ctrl, means hold Ctrl and press other key) 2. Press enter to confirm |
1. Esc to exit 'insert mode' 2. Type :w |
C-x C-s (Common notation meaning hold down the Ctrl key and press the other key) |
To Exit | ^X |
1. Esc to exit 'insert mode' 2. Type :q *Save and Quit is :wq |
C-x C-c |
If there are any further questions, or there is an issue with the documentation, please contact rc-help@rit.edu for additional assistance.