Back to Reference Guides
DevOps & SysadminPOSIX & Bash 5.0+ Compatible
Linux & Bash Shell Scripting Cheat Sheet
Essential CLI commands for server administration, file permissions, log filtering, piping, and network debugging.
File & Directory Navigation
ls -laList all files including hidden with permissions and human-readable sizesfind . -name "*.log" -mtime +30Find all .log files modified more than 30 days agodu -sh * | sort -hEstimate file space usage sorted from smallest to largesttar -czvf archive.tar.gz /pathCompress a folder into a gzip tar archivetar -xzvf archive.tar.gzExtract a gzip tar archive into current working directoryPermissions & User Ownership
chmod 755 <script.sh>rwxr-xr-x: Owner read/write/execute, group and others read/executechmod 600 <id_rsa>rw-------: Strict owner read/write only (standard for SSH private keys)chmod +x <file>Grant execute permission to current userchown -R www-data:www-data /var/wwwRecursively change user and group ownership of a directoryPiping, Filtering & Text Processing
grep -rn "ERROR" /var/log/Search recursively for "ERROR" showing line numbersawk '{print $1, $4}' access.logExtract and print column 1 and column 4 from log filessed -i 's/old/new/g' file.txtFind and replace all occurrences of "old" with "new" in-placesort file.txt | uniq -c | sort -nrCount unique lines and rank by frequency of occurrencecat access.log | tail -n 100 -fFollow the last 100 lines of an active log file in real timeProcess Monitoring & System Health
top / htopInteractive real-time process viewer and system load monitorps aux | grep nodeFind all running processes associated with Node.jskill -9 <PID>Force kill a process by Process IDnetstat -tulpn / ss -tulpnList all listening TCP and UDP ports with PID informationdf -hDisplay disk usage for all mounted file systems in GB/MBfree -mDisplay total, used, and free RAM memory in megabytesNetwork & API Debugging
curl -I https://tools.ubify.appFetch HTTP response headers only without downloading bodycurl -X POST -H "Content-Type: application/json" -d '{"k":"v"}' URLSend POST request with JSON payloaddig +short domain.comQuick DNS lookup returning resolved IP addressestraceroute / mtr domain.comTrace network hops and packet loss to target host