←Back to Guides
๐ŸงLinux Sysadminโฑ๏ธ 14 min read•Updated October 2026

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.

#Linux#Bash#Terminal#Sysadmin#DevOps#Networking#Permissions

1. File & Directory Operations

Essential commands for searching, viewing, archiving, and synchronizing files in bash environments.
List Files with Detailed Permissions & Human Sizes
ls -lah

Lists all hidden files, owners, permissions, and file sizes in KB/MB/GB.

Find Large Files Over 100MB
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null

Locates large files consuming disk space across the entire filesystem.

Recursive Grep with Line Numbers
grep -rnwi "/var/log" -e "error"

Searches case-insensitively for the word "error" in all files under /var/log.

Compress & Extract Tar Gzip Archives
# Compress directory:
tar -czvf backup.tar.gz /path/to/folder

# Extract archive:
tar -xzvf backup.tar.gz -C /target/dir

Creates and unpacks compressed gzip tarballs.

High-Speed Rsync with Progress
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)

Linux file permissions are divided into User (Owner), Group, and Others. Each category has Read (`4`), Write (`2`), and Execute (`1`) bits: - **777** (`rwxrwxrwx`) – Read, write, execute for everyone (insecure). - **755** (`rwxr-xr-x`) – Owner full rights; group and others can read and execute (ideal for executables and directories). - **644** (`rw-r--r--`) – Owner can read/write; everyone else read-only (standard for files and web assets). - **600** (`rw-------`) – Owner only (mandatory for private SSH keys like `id_ed25519`). - **700** (`rwx------`) – Owner only (mandatory for `~/.ssh` directories).
Secure SSH Directory & Private Keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pub

Enforces correct strict permissions required by OpenSSH.

Bulk Fix Permissions for Web Roots
# 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.

Change Owner and Group Recursively
chown -R www-data:www-data /var/www/html

Assigns ownership to the web server user.

3. Process Management & Systemd Services

Control daemonized services, inspect logs, and manage rogue processes.
Manage System Services with Systemctl
systemctl status nginx
systemctl restart nginx
systemctl enable --now nginx
systemctl reload nginx

Checks status, restarts, enables on boot, and reloads configs without downtime.

Follow Service Logs with Journalctl
journalctl -u nginx -f --since "30 min ago"

Live tailing of systemd logs for a specific service.

Find and Terminate Rogue Processes
# 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)

Diagnose server load spikes, memory starvation, and full disk partitions.
Check Disk Space in Human Units
df -hT --exclude-type=tmpfs --exclude-type=squashfs

Displays disk usage per mounted partition with filesystem types.

Find Largest Folders in Current Directory
du -sh * | sort -h

Calculates directory sizes and sorts them in ascending human order.

Check Free & Available Memory
free -m -h

Displays total, used, free, shared, buffer/cache, and available RAM.

5. Networking & Port Auditing

Inspect open listening sockets, test HTTP endpoints, and verify routing.
Inspect All Active Listening Ports
ss -tulpn

Shows TCP and UDP listening ports with associated process names and PIDs.

Inspect HTTP Response Headers and Latency
curl -Iv https://example.com --compressed

Fetches TLS handshake info and HTTP headers without downloading the full body.

Show All Network Interfaces and IP Addresses
ip -c addr show

Displays colorized interface names and IPv4/IPv6 addresses.

๐ŸŽ“Explore More Guides

โœจ