Text editors are used to:
- Create files
- Edit configuration files
- Write scripts
- Modify code
- Manage server settings
Most common Linux terminal editors:
- vi
- vim
- nano
1. vi Editor
What is vi?
vi stands for Visual Editor.
It is one of the oldest and most important Unix text editors.
Available in almost every Linux system.
Features of vi
- Lightweight
- Fast
- Keyboard-driven
- Works in minimal systems
- Available in recovery mode environments
Open File in vi
vi filename.txt
Example:
vi nginx.conf
Important Navigation Keys
| Key | Action |
|---|---|
| h | Left |
| l | Right |
| k | Up |
| j | Down |
Useful vi Commands
| Command | Purpose |
|---|---|
| dd | Delete line |
| yy | Copy line |
| p | Paste |
| /word | Search word |
| u | Undo |
2. vim Editor
What is vim?
vim = Vi Improved
Vim
Advanced version of vi.
Features of vim
- Syntax highlighting
- Better navigation
- Plugins support
- Undo/redo improvements
- Better scripting support
- Search highlighting
Open File in vim
vim filename.txt
Install vim
Ubuntu/Debian
sudo apt install vim -y
Important vim Features
Syntax Highlighting
Useful for:
- Python
- YAML
- Shell scripts
- JSON
- Kubernetes manifests
Enable Line Numbers
Inside vim:
:set number
Search Text
/nginx
Replace Text
:%s/old/new/g
Real-World Usage
Edit Docker Compose
vim docker-compose.yml
Edit Bash Script
vim backup.sh
Why vim is Popular in DevOps
- Fast remote editing
- Works over SSH
- Efficient keyboard shortcuts
- Available on most Linux servers
- Handles huge files efficiently
3. nano Editor
What is nano?
nano is a simple beginner-friendly terminal editor.
GNU nano
Features of nano
- Easy to learn
- On-screen shortcuts
- Beginner friendly
- Simple editing
Open File in nano
nano filename.txt
Example:
nano notes.txt
Important nano Shortcuts
| Shortcut | Purpose |
|---|---|
| CTRL + O | Save |
| CTRL + X | Exit |
| CTRL + K | Cut line |
| CTRL + U | Paste |
| CTRL + W | Search |
Real-World Usage
Edit Config Quickly
nano .env
Edit Small Scripts
nano deploy.sh
Top comments (0)