Operating Systems & Administration
[Day 5] 2. VI Editor
D
DITISS AdminVI Editor Overview
VIM stands for VI IMproved, an enhanced version of the VI text editor. It's a powerful CLI (Command Line Interface) editor commonly used in Linux systems.
1. Installation Commands:
-
Install VIM using
:apt
sudo apt-get install vim -
Install VIM using
:snap
sudo snap install vimBoth
andsnapare package managers that install various software packages on your system.apt
2. VIM Modes
VIM operates in three modes:
- Command Mode:
- Access by pressing .
Esc - This mode allows you to give commands to save, copy, cut, and perform other actions.
- Access by pressing
- Text Mode / Insert Mode:
- Access by pressing .
i - This mode is used to add or insert content into the file.
- Access by pressing
- Visual Mode:
- Access by pressing .
v - Used to select text within the editor.
- Access by pressing
By default, the VI editor opens in Command Mode.
3. Common VIM Commands
File Operations:
- : Save or write to the file.
:w - : Quit or exit the VI editor.
:q - : Save and quit the file.
:wq
Copy (Yank) Commands:
- : Copy the current line.
:y - : Copy the current line.
yy - : Copy the
:nyth line.n - : Copy the next
nyylines from the current line.n - : Copy lines from line
m,nyto linem.n - : Copy the next word.
yw - : Copy from the cursor position to the end of the line.
y$ - : Copy from the start of the line to the cursor position.
y^
Cut (Delete) Commands:
- : Cut the current line.
:d - : Cut the current line.
dd - : Cut the
:ndth line.n - : Cut the next
nddlines from the current line.n - : Cut lines from line
m,ndto linem.n
Delete Commands (without pasting):
- : Delete the current line.
:d - : Delete the current line.
dd - : Delete the
:ndth line.n - : Delete the next
nddlines from the current line.n - : Delete lines from line
m,ndto linem.n
Paste and Undo:
- : Paste the copied line.
p - : Undo the last action.
u
Read Next
8/26/2026
[Day 5] 3. Shell Scripting or Shell Programming
### Shell Scripting Overview **Shell scripting** is interpreted by the shell itself and is mainly used for: - Automation - Configuration - Wri...
8/26/2026
[Day 6] 1. Spacing in Shell Scripting
#### **Assignment Operator** - When writing a variable assignment, there should **not** be any spaces between the variable name, assignment operato...