Text Editors
Vi and Vim (The Powerhouse)
Section titled “Vi and Vim (The Powerhouse)”Vim (Vi IMproved) is the standard visual editor found on almost every Unix-based system. It is “modal,” meaning the keys on your keyboard do different things depending on which “mode” you are in.
- Command Mode: The default starting mode. Typing letters here doesn’t write text; instead, it executes commands (e.g.,
ddto delete a line,uto undo). - Insert Mode: Triggered by pressing
i. This is where you actually type text into your file. PressEscto leave this mode. - Last-Line Mode: Triggered by typing a colon (
:) from Command Mode. This is used for saving (:w), quitting (:q), or saving and quitting together (:wq).
How to use it daily: Use Vim when you need to make fast, powerful edits to code or configuration files. If you are new, run the command vimtutor in your terminal for a 30-minute interactive lesson.
Nano (The User-Friendly Choice)
Section titled “Nano (The User-Friendly Choice)”Nano is a “modeless” editor, which makes it feel much more like a standard Windows or Mac notepad.
- What it is: A simple, lightweight editor where every key you press immediately enters text.
- Navigation: You use Control (Ctrl) or Alt (Meta) keys for commands, which are conveniently listed at the bottom of the screen.
- Common Shortcuts: *
Ctrl+O: Save (Write Out).Ctrl+X: Exit.Ctrl+K: Cut a line.Ctrl+U: Paste (Uncut).
How to use it daily: Use Nano for quick, simple edits where you don’t want to deal with switching modes. It is perfect for beginners who just need to change one line in a file and get out quickly.
Visudo (The Safety Guard)
Section titled “Visudo (The Safety Guard)”This is a specialized tool used exclusively for editing the /etc/sudoers file, which controls who has administrative (root) permissions on the computer.
- What it is: It is not a standalone editor but a command that opens your default editor (usually Vim or Nano) to change the “sudoers” file.
- The Safety Feature: When you save and exit, Visudo automatically checks your syntax. If you made a typo that could lock you out of your own system, it will warn you and ask you to fix it before finalizing the save.
How to use it daily: Never edit the /etc/sudoers file with a regular editor like nano /etc/sudoers. Always type sudo visudo instead. This ensures you don’t accidentally break your ability to use administrative commands.