Learn essential system administration and monitoring techniques
Click the green 💻 Terminal button in the bottom-right corner to open an interactive terminal. You can practice all the commands on this page in real-time!
Understanding and managing processes is crucial for system administration. Every running program is a process.
Key commands: ps📊 ps - Process StatusDisplays information about running processes. Essential for system monitoring and troubleshooting.List All Processes$ ps aux▸ Shows all processes with detailed informationCurrent User Processes$ ps ux▸ Shows processes for current user onlyFind Specific Process$ ps aux | grep firefox▸ Searches for processes containing 'firefox' top📈 top - Task ManagerInteractive real-time process viewer showing CPU, memory usage, and system statistics.Launch top$ top▸ Opens interactive process monitorSort by CPU$ Press 'P' in top▸ Sorts processes by CPU usageSort by Memory$ Press 'M' in top▸ Sorts processes by memory usage
# List all running processes
ps aux
# Show processes in a tree structure
pstree
# Interactive process viewer
top
# Modern alternative to top
htop
# List processes for current user
ps ux
# Find specific process
ps aux | grep firefox
Key commands: kill🛑 kill - Terminate ProcessSends signals to processes, typically to terminate them. Use PID (Process ID) to target specific process.Graceful Termination$ kill 1234▸ Sends SIGTERM (allows cleanup)Force Kill$ kill -9 1234▸ Sends SIGKILL (immediate termination)Kill by Name$ killall firefox▸ Kills all processes named 'firefox' bg⏯️ bg - Background ProcessResumes a suspended job in the background, allowing you to continue using the terminal.Resume Latest Job$ bg▸ Continues most recent suspended job in backgroundResume Specific Job$ bg %2▸ Resumes job number 2 in background fg▶️ fg - Foreground ProcessBrings a background job to the foreground, giving it control of the terminal.Bring Latest Job Forward$ fg▸ Brings most recent background job to foregroundBring Specific Job$ fg %1▸ Brings job number 1 to foreground jobs📋 jobs - List Background JobsLists jobs running in the background or suspended in the current shell session.List All Jobs$ jobs▸ Shows all background and suspended jobsList with PIDs$ jobs -l▸ Shows jobs with their process IDs
# Kill process by PID
kill 1234
# Force kill a process
kill -9 1234
# Kill process by name
killall firefox
# Send SIGTERM signal
kill -15 1234
# Background a running process
Ctrl+Z # Suspend
bg # Continue in background
# Foreground a background process
fg
# Run command in background from start
command &
kill -9 forcefully terminates a process without cleanup. Use regular kill first to allow graceful shutdown.
# CPU and memory usage (interactive)
top
# Disk usage by filesystem
df -h
# Disk usage by directory
du -sh /home/user/*
# Memory usage
free -h
# System uptime and load average
uptime
# Who is logged in
who
# Detailed who information
w
When you run uptime, you see something like:
11:30:45 up 5 days, 3:42, 2 users, load average: 0.15, 0.25, 0.30
The three numbers represent average system load over 1, 5, and 15 minutes:
# View system log
sudo tail -f /var/log/syslog
# View authentication log
sudo tail -f /var/log/auth.log
# View kernel messages
dmesg | tail
# View systemd journal
journalctl -xe
# Follow journal in real-time
journalctl -f
Different Linux distributions use different package managers. Here are the most common ones:
# Update package list
sudo apt update
# Upgrade all packages
sudo apt upgrade
# Install a package
sudo apt install package-name
# Remove a package
sudo apt remove package-name
# Search for package
apt search keyword
# Show package information
apt show package-name
# Install package
sudo yum install package-name
sudo dnf install package-name
# Update all packages
sudo yum update
sudo dnf upgrade
# Remove package
sudo yum remove package-name
# Search for package
yum search keyword
# List installed packages
yum list installed
# Update package database and upgrade
sudo pacman -Syu
# Install package
sudo pacman -S package-name
# Remove package
sudo pacman -R package-name
# Search for package
pacman -Ss keyword
# List installed packages
pacman -Q
Modern Linux distributions use systemd to manage services (daemons).
# Start a service
sudo systemctl start nginx
# Stop a service
sudo systemctl stop nginx
# Restart a service
sudo systemctl restart nginx
# Check service status
sudo systemctl status nginx
# Enable service at boot
sudo systemctl enable nginx
# Disable service at boot
sudo systemctl disable nginx
# List all services
systemctl list-units --type=service
# List failed services
systemctl --failed
# Show IP addresses
ip addr show
ip a
# Show network interfaces (old method)
ifconfig
# Show routing table
ip route show
# Test connectivity
ping google.com
# Trace route to destination
traceroute google.com
# DNS lookup
nslookup google.com
dig google.com
# Show listening ports
sudo netstat -tuln
sudo ss -tuln
# Enable firewall
sudo ufw enable
# Disable firewall
sudo ufw disable
# Allow port
sudo ufw allow 80/tcp
sudo ufw allow ssh
# Deny port
sudo ufw deny 23
# Show status
sudo ufw status
# Show numbered rules
sudo ufw status numbered
# Delete rule by number
sudo ufw delete 2
# 1. Check what's using CPU
top
# Press 'P' to sort by CPU usage
# 2. Identify the problematic process
# Look at PID of high CPU process
# 3. Investigate the process
ps aux | grep [PID]
# 4. If needed, kill the process
kill [PID]
# 1. Check disk usage
df -h
# 2. Find large directories
du -sh /home/* | sort -h
# 3. Find large files
find /home -type f -size +100M -exec ls -lh {} \;
# 4. Clean up package cache (Ubuntu/Debian)
sudo apt clean
sudo apt autoremove
# 1. Check service status
sudo systemctl status servicename
# 2. View recent logs
sudo journalctl -u servicename -n 50
# 3. Check configuration
sudo systemctl cat servicename
# 4. Restart service
sudo systemctl restart servicename
Ready to practice? Head over to the Interactive Terminal to try system administration commands!