Linux Commands Cheatsheet — Essential Reference
Linux Commands Cheatsheet — Essential Reference
DodaTech
3 min read
Essential Linux commands for file management, permissions, processes, networking, text processing, and package management — a sysadmin’s daily reference.
File Operations
| Command | What it does |
|---|---|
ls -la | List files (detailed, hidden) |
cp -r src dst | Copy recursively |
mv src dst | Move or rename |
rm -rf dir | Remove recursively, force |
touch file | Create empty file or update timestamp |
cat file | Print file content |
less file | Scroll through file (q to quit) |
head -n 5 file | First 5 lines |
tail -f file | Follow log in real time |
mkdir -p a/b/c | Create nested directories |
Permissions
chmod 755 script.sh # rwxr-xr-x
chmod u+x script.sh # add execute for user
chown user:group file # change owner/group
chown -R user:group dir/ # recursivePermission modes: r=4, w=2, x=1 — chmod 644 = rw-r--r--
Processes
| Command | What it does |
|---|---|
ps aux | All running processes |
top / htop | Interactive process viewer |
kill -9 PID | Force kill process |
pkill nginx | Kill by name |
jobs | List background jobs |
fg %1 | Bring job to foreground |
command & | Run in background |
nohup command & | Run immune to hup |
Networking
| Command | What it does |
|---|---|
ping 8.8.8.8 | Test connectivity |
curl -s example.com | HTTP request |
wget url | Download file |
ssh user@host | SSH connection |
netstat -tulpn | Listening ports |
ss -tulpn | Modern alternative |
ip a / ifconfig | Network interfaces |
scp file user@host:/path | Secure copy |
Package Management
| Distro | Command |
|---|---|
| Debian/Ubuntu | apt update && apt install pkg |
| RHEL/Fedora | dnf install pkg |
| Arch | pacman -S pkg |
| macOS | brew install pkg |
Text Processing
grep -r "error" /var/log/ # recursive search
grep -i "warning" log.txt # case-insensitive
grep -v "^#" config.conf # exclude comments
find /home -name "*.py" # find by name
find . -type f -size +10M # find by size
sort file.txt # sort lines
wc -l file.txt # count lines
uniq -c file.txt # count unique linessed & awk
sed 's/old/new/g' file.txt # replace all
sed -i '.bak' 's/old/new/g' file # in-place with backup
awk '{print $1, $3}' file.txt # print columns
awk '/error/ {print $0}' log.txt # filter + print
awk '{sum+=$1} END {print sum}' nums.txt # sum columnCompression
| Command | Ext | What it does |
|---|---|---|
tar czf archive.tar.gz dir/ | .tar.gz | Compress |
tar xzf archive.tar.gz | .tar.gz | Extract |
zip -r archive.zip dir/ | .zip | Compress |
unzip archive.zip | .zip | Extract |
See the full Linux administration guides for more.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro