Operations 47 min read

60 Essential Linux Commands Every Sysadmin Should Master

A comprehensive, fast‑track guide for Linux system administrators that covers modern tools, shell configuration, and over 60 indispensable commands for file handling, text processing, system monitoring, networking, process control, permissions, and disk management, plus best‑practice tips and troubleshooting scripts.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
60 Essential Linux Commands Every Sysadmin Should Master

Overview

This guide collects 60 practical Linux commands gathered from ten years of operations experience, focusing on modern tools (ripgrep, fd, bat, eza, dust) and container‑aware usage.

Environment Requirements

# Tested on Ubuntu 24.04, Rocky Linux 9.3, Debian 12
# Kernel 6.5+
# Shell: Bash 5.2+, Zsh 5.9+
# Modern tools:
# ripgrep 14.1+
# fd 9.0+
# bat 0.24+
# eza 0.18+
# dust 1.0+

Installation of Modern Tools

# Ubuntu/Debian
sudo apt update && sudo apt install -y ripgrep fd-find bat eza
# Rocky Linux/RHEL
sudo dnf install -y ripgrep fd-find bat eza
# Install via Cargo (any distro)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
cargo install ripgrep fd-find bat eza dust

Shell Configuration

# ~/.bashrc or ~/.zshrc
# History settings
HISTSIZE=50000
HISTFILESIZE=100000
HISTCONTROL=ignoreboth:erasedups
HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
shopt -s histappend
# Safer aliases
alias rm='rm -I --preserve-root'
alias cp='cp -i'
alias mv='mv -i'
alias ln='ln -i'
# Modern command aliases
alias ls='eza --icons'
alias ll='eza -alh --git --icons'
alias cat='bat --paging=never'
alias grep='rg'
alias find='fd'
alias du='dust'

Core Command Categories

1. File Operations (ls/eza, cp/rsync, mv, rm, mkdir, tar)

# List files with colors and Git status
ls -la
# Safer copy with progress
rsync -avz --progress source/ dest/
# Archive and compress
tar -czvf backup.tar.gz /data
# Extract with zstd (2025 recommendation)
tar --zstd -xvf backup.tar.zst

2. Text Processing (grep/rg, fd, awk, sed, cut, sort, uniq, wc)

# Fast recursive search
rg "error" /var/log
# Find files quickly
fd "\.log$" /var/log
# Count lines, words, bytes
wc -l /var/log/syslog
# One‑liner to extract IPs
awk '{print $1}' access.log | sort | uniq -c | sort -rn

3. System Monitoring (top/htop/btop, vmstat, iostat, sar, free, df)

# Real‑time process view
btop
# Memory overview
free -h
# Disk I/O statistics
iostat -xz 2 5
# Historical CPU usage
sar -u 2 10

4. Network Diagnostics (ip, ss, netstat, ping, traceroute/mtr, curl, wget, dig, tcpdump, iptables/nftables)

# Show interfaces and IPs
ip addr
# List listening sockets with process info
ss -tuln
# Test connectivity
ping -c 5 8.8.8.8
# Trace route with TCP fallback
traceroute -T example.com
# Quick HTTP request with timing
curl -w "%{time_total}
" -o /dev/null -s https://example.com

5. Process Management (ps, top, kill/pkill/killall, pgrep, nohup, screen/tmux, systemctl, nice/renice, timeout, watch)

# Show all processes with tree view
ps auxf
# Graceful restart of a service
systemctl reload nginx
# Kill a runaway process
kill -9 1234
# Run a command in background with logging
nohup ./backup.sh > backup.log 2>&1 &
# Monitor a command every 2 seconds
watch -n 2 "df -h"

6. User & Permission Management (useradd/usermod/userdel, chmod, chown, sudo, su)

# Create a service account without login shell
useradd -r -m -d /opt/app -s /sbin/nologin appuser
# Secure directory for web files
chown -R www-data:www-data /var/www/html
chmod 750 /opt/scripts/deploy.sh

7. Disk & Storage (df, du/dust, mount/umount, lsblk/fdisk, dd)

# Human‑readable disk usage
df -h
# Visual directory size
du -sh * | dust
# List block devices with FS type
lsblk -f
# Clone a disk (use with caution)
dd if=/dev/sda of=/dev/sdb bs=4M status=progress

Best Practices & Common Pitfalls

Prefer rg over grep and fd over find for speed.

Avoid pipelines like cat file | grep; use grep directly.

Use parallel execution ( xargs -P or parallel) for batch operations.

Never run rm -rf $UNDEFINED_VAR/*; always quote variables and provide defaults.

Apply the principle of least privilege: set strict chmod and chown on scripts and keys.

Troubleshooting & Monitoring Script Example

#!/bin/bash
CPU_THRESHOLD=80
MEM_THRESHOLD=85
DISK_THRESHOLD=90
CPU_USAGE=$(top -bn1 | grep "Cpu(s)" | awk '{print 100-$8}' | cut -d. -f1)
MEM_USAGE=$(free | awk '/Mem/ {printf "%d", $3/$2*100}')
DISK_USAGE=$(df -h / | awk 'NR==2 {print $5}' | tr -d '%')
alert(){ echo "[ALERT] $(date '+%Y-%m-%d %H:%M:%S') $1" >> /var/log/monitor.log; }
[[ $CPU_USAGE -gt $CPU_THRESHOLD ]] && alert "CPU usage is $CPU_USAGE%"
[[ $MEM_USAGE -gt $MEM_THRESHOLD ]] && alert "Memory usage is $MEM_USAGE%"
[[ $DISK_USAGE -gt $DISK_THRESHOLD ]] && alert "Disk usage is $DISK_USAGE%"

Conclusion

The cheat sheet equips administrators with modern, efficient command‑line tools, solid best‑practice guidelines, and ready‑to‑use scripts for monitoring and troubleshooting, enabling faster, safer, and more reliable Linux operations.

References

Linux man pages – man <command> TLDR pages – tldr <command> Explainshell.com – interactive command explanations

Linux Performance by Brendan Gregg

The Linux Command Line by William Shotts

CLIAutomationLinuxsysadmincommands
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.