20 Actually Useful Linux One-Liners (2026)
Most Linux one-liner lists give you ls -la and grep -r. You already know those. This list covers the commands that solve actual sysadmin and development problems — disk emergencies, process hunting, network debugging, and automation. Every one-liner here has saved me at least once on a Friday afternoon.
Process Management
Find the 10 largest files in a directory tree — find . -type f -exec du -sh {} + | sort -rh | head -10
Kill all processes by name — pkill -f "node app.js" or kill $(pgrep -f "node app.js")
Show CPU and memory usage per process, sorted — ps aux --sort=-%cpu | head (replace %cpu with %mem for memory)
Logs & Monitoring
Monitor a log file in real time with timestamps — tail -f app.log | while read line; do echo "$(date '+%H:%M:%S') $line"; done
Watch a command every N seconds — watch -n 2 'netstat -tulpn | grep :3000' — re-runs the command every 2 seconds with a clear screen.
Disk & Storage
Disk usage per directory, human-readable, top 10 — du -sh */ | sort -rh | head -10
Count files per directory recursively — for d in */; do echo "$d: $(find "$d" -type f | wc -l)"; done
Find files modified in the last 24 hours — find . -type f -mtime -1
Network
Check which ports are listening — ss -tulpn (modern replacement for netstat)
Get your external IP — curl -s ifconfig.me or curl -s icanhazip.com
Check SSL certificate expiry date — echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -noout -dates
Download an entire website recursively — wget --mirror --page-requisites --convert-links --no-parent -e robots=off -P ./site https://example.com
File Operations
Bulk rename files (replace spaces with underscores) — for f in *\ *; do mv "$f" "${f// /_}"; done
Extract tar.gz to a directory — tar -xzf archive.tar.gz -C /target/directory
Find text in files, excluding node_modules — grep -r --exclude-dir=node_modules --exclude-dir=.git "search_term" .
Rsync with progress bar — rsync -avh --progress /source/ /destination/
System Info & Security
List all users on the system — cut -d: -f1 /etc/passwd
Dump full system information — uname -a && lscpu && free -h && df -h
Check system uptime and load — uptime — shows how long since last reboot, number of users, and 1/5/15 minute load averages.
Generate a random 32-character password — openssl rand -base64 24
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro