Linux Vi Editor and Shell Commands Reference
1. Vi Editor
A terminal-based text editor for Unix/Linux systems.
Modes in Vi:
- Command Mode (Default): Navigation & text manipulation
- Insert Mode (i): Edit/insert text
- Last Line Mode (:): Save, quit, search
Basic Vi Commands:
Command Description Example
vi file Open/create file vi notes.txt
:w Save file :w
:q Quit :q
:wq Save & quit :wq
:q! Quit without saving :q!
dd Delete line Press dd
/text Search for 'text' /hello
2. Linux Shells
A shell is a command-line interpreter.
Shell Description
sh Original Unix shell
bash Default on Linux (Bourne Again Shell)
zsh Extended features, user-friendly
fish Auto-suggestions, modern UI
3. Basic Linux Commands
File Operations:
Command Description Example
Linux Vi Editor and Shell Commands Reference
ls List files ls -l
pwd Show directory pwd
cd Change directory cd /home
mkdir Create directory mkdir folder
rm Delete file rm file.txt
cp Copy file cp file1.txt file2.txt
mv Move/rename file mv old.txt new.txt
System Info:
Command Description Example
whoami Current user whoami
uname -a System info uname -a
df -h Disk space df -h
top Running processes top
uptime System uptime uptime
free -m Memory usage free -m
Networking:
Command Description Example
ping Test connection ping google.com
ifconfig Network config ifconfig
wget Download file wget http://example.com/file
curl Transfer data curl http://example.com
netstat -tuln Show ports netstat -tuln
User Management:
Command Description Example
passwd Change password passwd
useradd Add user useradd newuser
usermod Modify user usermod -aG sudo username
deluser Delete user deluser username
Linux Vi Editor and Shell Commands Reference
id User ID info id
4. Useful Shortcuts
Ctrl+C -> Stop current command
Ctrl+Z -> Pause process
Ctrl+D -> Exit terminal
Ctrl+R -> Search command history
Tab -> Auto-complete
!! -> Repeat last command
!abc -> Run last command starting with 'abc'