Linux Shell Commands

Essential Linux / Unix shell commands — file system, text processing, processes, networking.

Reference Reference Updated Apr 19, 2026
Reference

File system

Command Purpose
ls -la List files with details, including hidden
cd DIR Change directory
pwd Print working directory
cp SRC DST Copy file (-r for recursive)
mv SRC DST Move / rename
rm -rf DIR Remove recursively, force
mkdir -p PATH Create directory tree
ln -s TARGET LINK Create symbolic link
chmod 755 FILE Set permissions
chown user:group FILE Change ownership
du -sh DIR Directory size, human-readable
df -h Disk free space
find . -name "*.log" Find files by name

Text processing

Command Purpose
cat FILE Print file
less FILE Paginated view (q to quit)
head -n 20 FILE First 20 lines
tail -f FILE Follow file (like logs)
grep -rn "text" . Recursive search with line numbers
sed -i "s/a/b/g" FILE In-place substitution
awk '{print $1}' First column
sort | uniq -c Count occurrences
wc -l FILE Count lines
cut -d, -f1 FILE First CSV column
tr a-z A-Z Translate characters

Processes

Command Purpose
ps aux All processes
top / htop Interactive process monitor
kill -9 PID Force kill
pkill NAME Kill by name
jobs Background jobs
nohup CMD & Run detached
<cmd> & Background
Ctrl+Z / fg / bg Suspend / foreground / background

Networking

Command Purpose
ip addr Show interfaces & IPs
ss -tulpn Listening sockets (replaces netstat)
curl -sSL URL HTTP request
wget URL Download file
ping HOST ICMP reachability
dig NAME DNS lookup
ssh user@HOST Remote shell
scp FILE user@HOST:/path Secure copy
rsync -av SRC DST Efficient sync

Last updated: