Advanced Text-Fu · Lesson 2 of 13
Text Editors
0 / 5 checkpoints answered
Linux configuration, scripts, source code, and logs are commonly stored as plain text. A terminal editor lets you work with those files in a local terminal, a remote SSH session, or an environment without a graphical desktop.
Choosing an Editor for the Environment
No single editor is best for every person or task. Graphical editors, terminal editors, and integrated development environments can all be appropriate. For command-line work, choose an editor that is installed, that you can exit safely, and whose basic editing model you understand.
Do not assume Vim or Emacs is installed. Check command resolution in the current shell:
$ command -v vim
/usr/bin/vim
$ command -v emacs
/usr/bin/emacs
An empty result with a nonzero status means that name was not found through the current command search. Minimal systems may provide vi, while others include Nano or no interactive editor at all.
CheckWhich command checks whether the current shell can resolve an executable named vim?
press 1/2/3 to answer · → next lesson
Understanding Vim's Model
Vim is a modal editor. The same key can have different meanings depending on the current mode:
- Normal mode interprets keys as navigation and editing commands.
- Insert mode inserts typed text.
- Command-line mode accepts commands such as writing or quitting.
This model makes repeated keyboard editing efficient after practice, but new users must keep track of the active mode. Later lessons introduce Vim one operation at a time.
CheckWhat does it mean that Vim is modal?
press 1/2/3 to answer · → next lesson
Understanding Emacs's Model
Emacs commonly uses key combinations and named commands within an extensible environment. Files are visited in buffers, and major and minor modes customize behavior for different content and tasks. Emacs can run in a terminal or a graphical frame.
Vim and Emacs both support far more than basic editing through configuration and extensions. Begin with opening, changing, saving, and closing a plain-text file before adding customization.
CheckIn Emacs terminology, where is a visited file's editable text normally held?
press 1/2/3 to answer · → next lesson
Setting a Preferred Editor
Many command-line programs consult VISUAL or EDITOR when they need to start an editor. For example, choose Vim for commands launched from the current Bash session and its children:
$ export VISUAL=vim
$ export EDITOR="$VISUAL"
These variables express a preference; they do not install the program. Use a command that actually exists, and place the exports in the appropriate shell startup file only after testing them.
CheckWhat does export EDITOR=vim do?
press 1/2/3 to answer · → next lesson
Practicing without Risking Important Files
Learn on a disposable file in a directory you own:
$ printf 'first line\nsecond line\n' > editor-practice.txt
$ vim editor-practice.txt
Avoid beginning with system configuration or another user's data. Make a backup before changing an important file, understand how to save and exit, and review the result with a read-only command such as cat or diff.
CheckWhat is the safest first file for practicing an unfamiliar editor?
press 1/2/3 to answer · → next lesson
To practice opening, editing, and saving terminal text files, try this hands-on lab:
- Edit Text Files in Linux with Vim and Nano - Practice creating files, editing text, saving files, and navigating with both vi/vim and nano, essential skills for any Linux user.
Summary
You can now choose a terminal editor and prepare a safe practice workflow.
- Check whether an editor command is available.
- Recognize Vim's modal interaction model.
- Recognize Emacs buffers and extensible modes.
- Set an editor preference without confusing it with installation.
- Practice on disposable text before editing important files.
Lesson complete
You finished Text Editors. Nice work — keep the momentum going.