1. Normal Mode Commands (Navigation, Editing, and Operations in
Normal Mode)
Command Description
yy Copy line
dd Delete line
p Paste line
/text Search text
/hostname Search for "hostname"
n Jump to next search occurrence
2. Insert Mode Commands (Commands to Enter Insert Mode and Work in
Insert Mode)
Command Description
i Enter insert mode at cursor
a Enter insert mode after cursor
o Open new line and enter insert mode
Text entry (typing directly) Type text after entering insert mode
3. Command Mode Commands (Commands After Pressing : in vi)
Command Description
:w Save file
:q Quit editor
:wq Save and quit
:q! Quit without saving
:%s/Linux/UNIX/g Replace "Linux" with "UNIX" globally
4. View Mode Commands (For Viewing, Searching, or Navigating)
Command Description
/text Search for text
/hostname Search for "hostname"
n Jump to next search occurrence
1. Other Editors (nano - not mode-based like vi)
, Command Description
nano filename.txt Open file in nano
Ctrl + O Save file in nano
Ctrl + X Exit nano
Ctrl + K Cut text
Ctrl + U Paste text
Ctrl + W Search text
Ctrl + G Show help menu
2. General File Viewing (Outside Editors)
Command Description
cat /etc/myconfig.conf View file content
Command Description
nano filename.txt Open file in nano
Ctrl + O Save file in nano
Ctrl + X Exit nano
Ctrl + K Cut text
Ctrl + U Paste text
Ctrl + W Search text
Ctrl + G Show help menu
vi filename.txt Open file in vi
i, a, o Enter insert mode
Esc Exit insert mode
:w Save file
:q Quit editor
:wq Save and quit
:q! Quit without saving
yy Copy line
dd Delete line
, Command Description
p Paste line
/text Search text
/hostname Search for "hostname"
n Jump to next search occurrence
:%s/Linux/UNIX/g Replace "Linux" with "UNIX" globally
cat /etc/myconfig.conf View file content
Process Management
1. Viewing Processes
Command Description Example Output
PID TTY TIME CMD
Displays a snapshot of currently
ps ps 1234 pts/1 00:00:00 bash
running processes 5678 pts/1 00:00:00 ps
ps -aux Shows a detailed list of all running ps -aux USER PID %CPU %MEM VSZ
RSS TTY STAT START TIME
processes
COMMAND
hint root 1 0.0 0.1 16900 1700
? Ss 10:00 0:00
USER The user who owns the process (e.g., root, user1).
/sbin/init
Process ID – A unique number assigned to each
PID
running process.
user 2345 0.1 0.3 37200
The percentage of CPU usage by the process 3600 pts/0 R+ 10:05 0:00
%CPU ps -aux
(higher values = CPU-intensive).
The percentage of physical memory (RAM) usage
%MEM
by the process.
Total virtual memory (in KB) allocated to
VSZ (Virtual
the process, including code, data, and
Memory Size)
shared libraries.
Actual physical memory (RAM) used by
RSS (Resident
the process, excluding swapped-out
Set Size)
memory.
The terminal (TTY) associated with the process (? if
TTY
no terminal is assigned).
The current state of the process:
R = Running
S = Sleeping
STAT (Process State)
Z = Zombie
T = Stopped
D = Uninterruptible Sleep
START The time the process started running.
TIME The total CPU time the process has consumed