⚡ Introducing Ubify Nexus: The all-in-one Operating System for YouTube Learners & Researchers.Claim 3 Months Free Pro →
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 sizes
find . -name "*.log" -mtime +30Find all .log files modified more than 30 days ago
du -sh * | sort -hEstimate file space usage sorted from smallest to largest
tar -czvf archive.tar.gz /pathCompress a folder into a gzip tar archive
tar -xzvf archive.tar.gzExtract a gzip tar archive into current working directory

Permissions & User Ownership

chmod 755 <script.sh>rwxr-xr-x: Owner read/write/execute, group and others read/execute
chmod 600 <id_rsa>rw-------: Strict owner read/write only (standard for SSH private keys)
chmod +x <file>Grant execute permission to current user
chown -R www-data:www-data /var/wwwRecursively change user and group ownership of a directory

Piping, Filtering & Text Processing

grep -rn "ERROR" /var/log/Search recursively for "ERROR" showing line numbers
awk '{print $1, $4}' access.logExtract and print column 1 and column 4 from log files
sed -i 's/old/new/g' file.txtFind and replace all occurrences of "old" with "new" in-place
sort file.txt | uniq -c | sort -nrCount unique lines and rank by frequency of occurrence
cat access.log | tail -n 100 -fFollow the last 100 lines of an active log file in real time

Process Monitoring & System Health

top / htopInteractive real-time process viewer and system load monitor
ps aux | grep nodeFind all running processes associated with Node.js
kill -9 <PID>Force kill a process by Process ID
netstat -tulpn / ss -tulpnList all listening TCP and UDP ports with PID information
df -hDisplay disk usage for all mounted file systems in GB/MB
free -mDisplay total, used, and free RAM memory in megabytes

Network & API Debugging

curl -I https://tools.ubify.appFetch HTTP response headers only without downloading body
curl -X POST -H "Content-Type: application/json" -d '{"k":"v"}' URLSend POST request with JSON payload
dig +short domain.comQuick DNS lookup returning resolved IP addresses
traceroute / mtr domain.comTrace network hops and packet loss to target host