Linux Terminal & Sysadmin Master Cheat Sheet: 100+ Essential Commands
The ultimate command-line guide for Linux engineers and sysadmins: file operations, chmod permissions, systemd services, resource auditing, and network troubleshooting.
1. File & Directory Operations
ls -lahLists all hidden files, owners, permissions, and file sizes in KB/MB/GB.
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/nullLocates large files consuming disk space across the entire filesystem.
grep -rnwi "/var/log" -e "error"Searches case-insensitively for the word "error" in all files under /var/log.
# Compress directory:
tar -czvf backup.tar.gz /path/to/folder
# Extract archive:
tar -xzvf backup.tar.gz -C /target/dirCreates and unpacks compressed gzip tarballs.
rsync -avzP --delete /source/dir/ user@remote:/target/dir/Copies files with archive preservation, compression, progress bar, and delta sync.
2. File Permissions & Ownership (Chmod / Chown)
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pubEnforces correct strict permissions required by OpenSSH.
# Directories to 755:
find /var/www/html -type d -exec chmod 755 {} \;
# Files to 644:
find /var/www/html -type f -exec chmod 644 {} \;Applies correct standards recursively without breaking subfolder traversal.
chown -R www-data:www-data /var/www/htmlAssigns ownership to the web server user.
3. Process Management & Systemd Services
systemctl status nginx
systemctl restart nginx
systemctl enable --now nginx
systemctl reload nginxChecks status, restarts, enables on boot, and reloads configs without downtime.
journalctl -u nginx -f --since "30 min ago"Live tailing of systemd logs for a specific service.
# Find PID by port:
lsof -i :8080
# Kill process gracefully:
kill -15 <PID>
# Force kill:
kill -9 <PID>Locates the process occupying a specific port and terminates it.
4. Resource Auditing (CPU, RAM, Disks)
df -hT --exclude-type=tmpfs --exclude-type=squashfsDisplays disk usage per mounted partition with filesystem types.
du -sh * | sort -hCalculates directory sizes and sorts them in ascending human order.
free -m -hDisplays total, used, free, shared, buffer/cache, and available RAM.
5. Networking & Port Auditing
ss -tulpnShows TCP and UDP listening ports with associated process names and PIDs.
curl -Iv https://example.com --compressedFetches TLS handshake info and HTTP headers without downloading the full body.
ip -c addr showDisplays colorized interface names and IPv4/IPv6 addresses.
Related Free Online Tools
Put these techniques into practice immediately with our privacy-first browser utilities:
Calculate octal and symbolic file permissions (755, 644, 700) with interactive toggles.
Calculate IPv4 CIDR blocks, subnet masks, usable hosts, and broadcast IPs.
Build and validate 5-field cron schedule expressions with human descriptions.