🧩 Help
·
Use `--help` with most commands: grep --help
·
Use `man` pages for detailed docs: man tar
·
Combine commands: ps aux | grep nginx | awk
'{print $2}'
·
Define shortcuts with aliases or scripts
📁 FILE & DIRECTORY
MANAGEMENT
ls: List
directory contents
- Syntax: ls [options] [path]
- Example: ls -l /etc
cd: Change
current directory
- Syntax: cd [directory]
- Example: cd ~/projects
pwd: Show
current directory path
- Syntax: pwd
- Example: pwd
mkdir: Create
directories
- Syntax: mkdir [options] directory_name
- Example: mkdir -p /tmp/foo/bar
rm: Remove
files or directories
- Syntax: rm [options] file_or_dir
- Example: rm -rf /tmp/foo
cp: Copy
files or directories
- Syntax: cp [options] source destination
- Example: cp -r ~/projects/app /backup/
mv: Move or
rename files/directories
- Syntax: mv [options] source destination
- Example: mv oldname.txt newname.txt
find: Search
files/directories
- Syntax: find [path] [conditions] [actions]
- Example: find /var/log -name "*.log" -type f
-mtime -7
📄 FILE VIEWING & TEXT
PROCESSING
cat: Show
file content
- Syntax: cat [file...]
- Example: cat /etc/hosts
less: View
content with pagination
- Syntax: less [file]
- Example: less /var/log/syslog
head: Show
first N lines
- Syntax: head -n [number] [file]
- Example: head -n 20 /var/log/syslog
tail: Show
last N lines
- Syntax: tail -n [number] [file]
- Example: tail -n 50 /var/log/syslog
grep: Search
for pattern
- Syntax: grep [options] pattern [file...]
- Example: grep -R "ERROR" /var/log
awk: Field-based
text processing
- Syntax: awk '{print $1}' [file]
- Example: awk '{print $1, $3}' /etc/passwd
sed: Stream
editor for text replacement
- Syntax: sed 's/old/new/g' [file]
- Example: sed 's/foo/bar/g' input.txt > output.txt
🔐 PERMISSIONS &
OWNERSHIP
chmod: Change
permissions
- Syntax: chmod [mode] [file]
- Example: chmod 644 file.txt
chown: Change
ownership
- Syntax: chown owner[:group] file
- Example: chown alice:developers project/
umask: Set
default permission mask
- Syntax: umask [mask]
- Example: umask 022
🛠 PROCESS MANAGEMENT
ps: Show
active processes
- Syntax: ps aux
- Example: ps aux | grep sshd
top: Real-time
system monitor
- Syntax: top
- Example: top
kill: Terminate
process by PID
- Syntax: kill -SIGNAL PID
- Example: kill -9 1234
killall: Terminate
processes by name
- Syntax: killall [process_name]
- Example: killall nginx
nice / renice:
Set/adjust process priority
- Syntax: nice -n [priority] command
renice
[priority] -p PID
- Example: nice -n 10 gzip largefile
renice +5
1234
💾 DISK & FILESYSTEM
df: Show
disk usage
- Syntax: df -h
- Example: df -h
du: Show
directory/file size
- Syntax: du [options] [file_or_dir]
- Example: du -sh *
mount / umount:
Mount or unmount filesystem
- Syntax: mount /dev/device /mnt
umount /mnt
- Example: mount /dev/sdb1 /mnt/backup
umount
/mnt/backup
lsblk: List
block devices
- Syntax: lsblk [options]
- Example: lsblk -f
fdisk / parted:
Manage partitions
- Syntax: fdisk [device]
parted
[device]
- Example: fdisk /dev/sda
parted
/dev/sdb print
🌐 NETWORKING
ping: Test
connectivity
- Syntax: ping [options] destination
- Example: ping -c 4 google.com
traceroute:
Show network route
- Syntax: traceroute [host]
- Example: traceroute google.com
dig: DNS
query tool
- Syntax: dig [domain] [record]
- Example: dig example.com A
nslookup: DNS
query
- Syntax: nslookup [name] [server]
- Example: nslookup example.com 8.8.8.8
curl: Transfer
data from/to a server
- Syntax: curl [options] URL
- Example: curl -I https://www.example.com
wget: Download
file from URL
- Syntax: wget [URL]
- Example: wget https://example.com/file.zip
👤 USER & ACCESS
whoami: Show
current user
- Syntax: whoami
- Example: whoami
id: Show
UID and groups
- Syntax: id [username]
- Example: id
su / sudo: Switch
user or run as root
- Syntax: su [user]
sudo
[command]
- Example: su -
sudo apt
update
🧰 SYSTEM SERVICES
systemctl: Manage
systemd services
- Syntax: systemctl [action] service
- Example: systemctl start nginx
journalctl:
View system logs
- Syntax: journalctl [options]
- Example: journalctl -u nginx.service --since
"2025-10-01"
crontab: Schedule
tasks
- Syntax: crontab -e
- Example: crontab -e
🗜 ARCHIVING &
COMPRESSION
tar: Archive
files
- Syntax: tar [options] archive file(s)
- Example: tar -czvf backup.tar.gz /home/user
gzip / gunzip:
Compress or decompress files
- Syntax: gzip [file]
gunzip
[file.gz]
- Example: gzip data.txt
gunzip
data.txt.gz
zip / unzip:
Create/extract ZIP archives
- Syntax: zip [archive] [file(s)]
unzip
[archive]
- Example: zip myfiles.zip *.txt
unzip
myfiles.zip -d dest_folder
🧩 MISC UTILITIES
uname: Show
system info
- Syntax: uname -a
- Example: uname -a
hostname: Show/set
hostname
- Syntax: hostname [name]
- Example: hostname
hostname
new-host
uptime: Show
system uptime
- Syntax: uptime
- Example: uptime
free: Show
memory usage
- Syntax: free -h
- Example: free -h
vmstat: System
performance stats
- Syntax: vmstat [delay] [count]
- Example: vmstat 1 5
lsof: List
open files
- Syntax: lsof [options]