IT 1100 : Introduction to Operating Systems
There are two types of text editors: GUI based and Text based.
GUI based editors only work on GUI based systems.
Text based editors work on both GUI and CLI systems.
Learning a text based editor is useful. You will always be able to edit files whether you are at a text based Terminal or a GUI based Desktop. Sometimes you will be logged into a system that doesn’t offer the GUI and you will need to know a text-based editor.
Anytime you learn a new text editor there are a few basic things you should know how to do.
- Open a file
- Edit a file
- Save a file
- Exit the program
Text Editors - Nano
- Nano comes pre-installed with Linux.
- It is a basic text editor.
- This is probably the easiest editor to learn.
- The most common shortcuts are listed at the bottom of the editor screen.
- Open a file:
- Edit a file: There is nothing special. Just start typing.
- Save a file(aka Write Out):
- Exit the program:
Text Editors - VIM
- VI / VIM
- VI comes pre-installed with most Linux distributions.
- VI and the enhanced version VIM are a text based editor.
- VIM is also available in a GUI version as an add on program.
- It is mode based. It has 3 main modes - normal mode , insert mode and visual mode.
- It uses commands to navigate and simplify the text editing experience instead of a mouse and buttons to click.
- This is the editor you will learn in this class.
Text Editors - VIM commands
* Open a file: `vi sauce.txt` * Edit a file: type `i` to enter insert mode. Start typing. * Use commands: type `esc` to return to normal mode. * Save a file: `:w` * Exit the program: `:q`
Text Editors - Emacs
- Emacs does not come pre-installed with Linux.
- It is a very popular and very powerful editor.
- It uses shortcuts to navigate and simplify the text editing experience.
- It comes in both Text based and GUI based versions.
Text Editors - Emacs commands
* Open a file: `emacs sauce.txt` * Edit a file: Again, nothing special. Just start typing. * Save a file: `Ctrl-x, Ctrl-s` * Exit the program: `Ctrl-x, Ctrl-c` * Cancel a half completed Shortcut: `Ctrl-g` * Undo: `Ctrl-x, u`
Text Editors - Gedit
- Gedit is a GUI based editor that comes pre-installed with your GUI installation.
- It can only run on a GUI based version of Linux.
Editing a file is the same command format no matter which editor you choose. And any text editor can open and edit any text document created by another editor.
- vi testing.txt
- vim testing.txt
- gvim testing.txt
- nano testing.txt
- emacs testing.txt
- gedit testing.txt
Opening a file with a text editor will automatically create the file if it doesn’t already exist. This is very helpful when you want to create a new file, but can be troublesome if you are trying to edit an existing file and have a typo in the name or an incorrect path. Linux can’t tell the difference.
If you open a file for editing and expect to find text inside of it but see a blank file instead - first thing to do is close the file and check the spelling and path of the file you are trying to edit. If you don’t know the correct path - try using the
The following resources are optional if you want to learn more
- vimtutor (It’s the built in Linux tutorial. Type the command to begin)
- Vi/Vim Reference Card Front
- Vi/Vim Reference Card Back
Optional Reading (More)
- There will be no textbook reading for this section.
- Go to the openvim.com website and complete the tutorial.
Last Updated 09/09/2019