Skip to main content
๐Ÿš€ Claude Code Bootcamp โ€” May 30 5 hours from prompting to production. Build 10 real-world projects with AI-assisted development. Register Now
Linux Commands Cheat Sheet 2026: Essential for DevOps
DevOps

Linux Commands Cheat Sheet 2026: Essential for DevOps

Linux commands cheat sheet for DevOps. File management, networking, processes, systemd, and troubleshooting. Copy-paste ready commands for daily operations.

LB
Luca Berton
ยท 1 min read

A quick reference for Linux system administration. Bookmark this page.

System Information

# OS and kernel
cat /etc/os-release
uname -r                    # Kernel version
hostnamectl                 # Hostname, OS, kernel, arch

# Hardware
lscpu                       # CPU info
free -h                     # Memory usage
lsblk                       # Block devices
lspci                       # PCI devices
lsusb                       # USB devices
dmidecode -t memory         # RAM details (needs root)

User and Group Management

# Users
useradd -m -s /bin/bash newuser    # Create user with home dir
usermod -aG sudo newuser           # Add to sudo group
userdel -r olduser                 # Delete user and home
passwd username                     # Change password
id username                         # Show user info
whoami                              # Current user

# Groups
groupadd devteam
usermod -aG devteam username
groups username

Package Management

# RHEL/CentOS/Rocky (dnf/yum)
sudo dnf update                     # Update all packages
sudo dnf install nginx              # Install package
sudo dnf remove nginx               # Remove package
sudo dnf search "web server"        # Search
sudo dnf info nginx                 # Package info
sudo dnf list installed             # List installed

# Ubuntu/Debian (apt)
sudo apt update && sudo apt upgrade
sudo apt install nginx
sudo apt remove nginx
sudo apt autoremove                 # Remove unused deps
apt search "web server"
apt show nginx

Service Management (systemd)

# Start/stop/restart
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx         # Reload config without restart

# Enable/disable on boot
sudo systemctl enable nginx
sudo systemctl disable nginx
sudo systemctl enable --now nginx   # Enable and start

# Status and logs
systemctl status nginx
journalctl -u nginx                 # Service logs
journalctl -u nginx -f              # Follow logs
journalctl -u nginx --since today   # Today's logs
journalctl -u nginx --since "1 hour ago"

File System

# Disk usage
df -h                       # Filesystem usage
du -sh /var/log              # Directory size
du -sh * | sort -rh | head -10  # Largest items

# Find files
find / -name "*.conf" -type f
find /var/log -mtime -1      # Modified in last day
find / -size +100M           # Files over 100MB
locate filename              # Fast search (needs updatedb)

# Mount
mount /dev/sdb1 /mnt/data
umount /mnt/data
cat /etc/fstab               # Persistent mounts

Networking

# IP and interfaces
ip addr show
ip route show
ip link show

# DNS
dig example.com
nslookup example.com
cat /etc/resolv.conf

# Connections and ports
ss -tlnp                    # Listening TCP ports
ss -tunap                   # All connections
netstat -tlnp               # (legacy, same as ss)

# Firewall (firewalld)
sudo firewall-cmd --list-all
sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload

# Firewall (ufw - Ubuntu)
sudo ufw status
sudo ufw allow 80/tcp
sudo ufw enable

SSH

# Connect
ssh user@host
ssh -i ~/.ssh/key.pem user@host
ssh -p 2222 user@host        # Custom port

# Key management
ssh-keygen -t ed25519 -C "email@example.com"
ssh-copy-id user@host        # Copy public key to server

# SSH tunnel
ssh -L 8080:localhost:80 user@host   # Local port forward
ssh -R 8080:localhost:80 user@host   # Remote port forward
ssh -D 1080 user@host                # SOCKS proxy

Tips and Tricks

  • Use alias ll='ls -lah' in .bashrc for quick listing
  • Use ctrl+r for reverse history search
  • Use screen or tmux for persistent sessions
  • Use watch -n 5 command to repeat command every 5 seconds
  • Use tee to write to file and stdout: command | tee output.log

Free 30-min AI & Cloud consultation

Book Now