Skip to content

Essential Ubuntu Commands Cheat Sheet for Server and Homelab Users

Whether you’re managing your own homelab, deploying services on a VPS, or learning Linux system administration, mastering the command line is a must. This article provides a clean and practical reference of essential Ubuntu commands, organized by category — from system updates and user management to networking and service control.

You can bookmark this page or download the commands as a quick-reference sheet for your daily Linux work.

🔄 System Update and Upgrade

Keep your Ubuntu system up to date and clean:

sudo apt update                 # Refresh package list

sudo apt upgrade                # Upgrade all packages

sudo apt dist-upgrade           # Full system upgrade

sudo apt autoremove             # Remove unused dependencies

sudo apt autoclean              # Clean old cached files

📦 Package Management

Install, remove, and manage software:

sudo apt install <package>      # Install a package

sudo apt remove <package>       # Remove a package

sudo apt purge <package>        # Remove with configuration

apt list –installed            # List installed packages

dpkg -l                         # Another method to list packages

🖥️ System Information and Resource Usage

Check system status, disk, memory, and more:

uname -a                        # Kernel version

lsb_release -a                  # Ubuntu version

uptime                          # System uptime

top                             # Real-time process monitor

htop                            # Enhanced system monitor (install separately)

free -h                         # Memory usage

df -h                           # Disk usage

du -sh /path                    # Folder size

🌐 Network Tools

Diagnose and manage networking:

ip a                            # View IP addresses

ip r                            # Routing table

ping google.com                 # Test connectivity

traceroute google.com           # Trace network path (install: traceroute)

netstat -tulnp                  # Open ports and services (install: net-tools)

ss -tuln                        # Native port scanner

curl ifconfig.me                # Get public IP

👤 User and Permission Management

Create and manage users and permissions:

sudo adduser newuser            # Create user

sudo usermod -aG sudo newuser   # Grant sudo rights

passwd                          # Change password

chmod 755 script.sh             # Set file permissions

chown user:group file.txt       # Change file owner

📁 File and Directory Operations

Basic file system commands:

ls -la                          # List with details

cd /path                        # Change directory

cp file.txt /destination/       # Copy file

mv file.txt /newname.txt        # Move or rename

rm file.txt                     # Delete file

rm -r folder/                   # Remove folder

mkdir newdir                    # Create folder

nano file.txt                   # Edit with nano

cat file.txt                    # Show file content

tail -f /var/log/syslog         # Follow system logs

⚙️ Service Management with systemd

Control background services and daemons:

sudo systemctl status nginx     # Check service status

sudo systemctl start nginx      # Start service

sudo systemctl stop nginx       # Stop service

sudo systemctl restart nginx    # Restart service

sudo systemctl enable nginx     # Enable on boot

sudo systemctl disable nginx    # Disable from boot

🧰 Disk and Partition Tools

Manage drives and partitions:

lsblk                           # Block devices overview

fdisk -l                        # List partitions

mount /dev/sdX1 /mnt            # Mount device

umount /mnt                     # Unmount

🔐 SSH and Remote Access

Secure shell access and remote file transfer:

sudo apt install openssh-server     # Install SSH server

sudo systemctl enable ssh           # Enable SSH at boot

sudo systemctl start ssh            # Start SSH service

ssh user@ip-address                 # Connect to remote system

scp file user@remote:/path/         # Copy file over SSH

🧹 System Maintenance

Clean logs and unnecessary files:

journalctl –vacuum-time=7d         # Clean logs older than 7 days

sudo apt autoremove && sudo apt autoclean

🧪 Development & Tools

Useful for coding and compiling:

sudo apt install build-essential    # Install compiler tools

gcc program.c -o program            # Compile C file

python3 script.py                   # Run Python script

✅ Bonus: Snap and Flatpak Support

If you’re using modern package systems:

sudo snap install <package>         # Install Snap package

sudo flatpak install <package>      # Install Flatpak app

Final Thoughts

This cheat sheet reflects my daily toolkit when working with Ubuntu on virtual machines, Proxmox containers, or dedicated servers. Whether you’re building a web server, a cloud platform, or simply exploring Linux, these commands form the foundation of system administration.

Leave a Reply

Your email address will not be published. Required fields are marked *

wpChatIcon
wpChatIcon