DEPARTMENT OF COMPUTING

IT 1100 : Introduction to Operating Systems

Chapter 12


Text Editors

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.


Text Editors

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.


Text Editors - Nano


Text Editors - VIM


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


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


Editor notes

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.

editor-name filename


Editor notes

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 find command.


Optional Reading

The following resources are optional if you want to learn more


Optional Reading (More)


Textbook Time


Last Updated 09/14/2023