Essential Ubuntu Server Commands Every Admin Should Know
Suresh Thapa
Essential Ubuntu Server Commands Every Admin Should Know
If you’re running Ubuntu Server (24.04 or any Linux server), there are a set of essential commands everyone should know to manage, troubleshoot, and secure the system.
step by step guide to install ubuntu server 24.04
I’ll break them into categories so you can learn step by step instead of just dumping a list.
1. System Information & Monitoring
| Command | What it does |
|---|---|
uname -a | Show kernel version & system info |
hostnamectl | Show or set system hostname |
lsb_release -a | Show Ubuntu version |
uptime | Show how long server has been running |
top / htop | Monitor CPU/memory usage (htop is better) |
free -h | Check RAM usage |
df -h | Show disk usage (human-readable) |
du -sh * | Show size of each directory/file |
ip a | Show all network interfaces & IP addresses |
ss -tuln | Show listening ports & services |
journalctl -xe | View detailed system logs |
2. Package Management (APT)
| Command | What it does |
|---|---|
sudo apt update | Update package lists |
sudo apt upgrade | Upgrade all installed packages |
sudo apt install <pkg> | Install a package |
sudo apt remove <pkg> | Remove a package |
sudo apt autoremove | Remove unused packages |
| `dpkg -l | grep <pkg>` |
3. File & Directory Management
| Command | What it does |
|---|---|
ls -lh | List files with size in human-readable format |
cd /path | Change directory |
pwd | Show current directory |
mkdir newdir | Create directory |
rm file | Delete a file |
rm -r dir | Delete directory recursively |
cp file1 file2 | Copy file |
mv file1 file2 | Move/rename file |
nano file / vim file | Edit a file |
cat file | Print file contents |
less file | View file contents (scrollable) |
tail -f logfile | Watch log file in real-time |
4. User & Permission Management
| Command | What it does |
|---|---|
whoami | Show current user |
id | Show user/group info |
adduser username | Add a new user |
passwd username | Change password |
deluser username | Delete user |
groups | Show groups of current user |
sudo usermod -aG group username | Add user to group (common: sudo usermod -aG sudo user) |
chmod 644 file | Change file permissions |
chown user:group file | Change file owner |
5. Networking & SSH
| Command | What it does |
|---|---|
ping 8.8.8.8 | Test network connectivity |
curl ifconfig.me | Show public IP |
ssh user@ip | Connect to server via SSH |
scp file user@ip:/path | Copy file over SSH |
rsync -avz /src user@ip:/dest | Sync files/directories |
6. Process & Service Management
| Command | What it does |
|---|---|
| ps aux | grep process |
kill -9 PID | Kill a process |
systemctl status service | Check service status |
sudo systemctl start service | Start service |
sudo systemctl stop service | Stop service |
sudo systemctl restart service | Restart service |
sudo systemctl enable service | Enable auto-start at boot |
sudo systemctl disable service | Disable auto-start |
7. Security & Firewall
| Command | What it does |
|---|---|
sudo ufw status | Show firewall status |
sudo ufw allow 22 | Allow SSH |
sudo ufw deny 80 | Block port |
sudo ufw enable | Enable firewall |
sudo fail2ban-client status | Check Fail2Ban status (if installed) |
8. Archiving & Transfers
| Command | What it does |
|---|---|
tar -czvf file.tar.gz dir/ | Compress directory |
tar -xzvf file.tar.gz | Extract archive |
zip -r file.zip dir/ | Zip folder |
unzip file.zip | Extract zip |
wget URL | Download file |
curl -O URL | Download file (alternative) |
9. Disk & Storage
| Command | What it does |
|---|---|
lsblk | Show disks/partitions |
mount /dev/sdX /mnt | Mount disk |
umount /mnt | Unmount disk |
df -Th | Show disk usage & filesystem type |
blkid | Show filesystem UUIDs |
10. Power & Shutdown
| Command | What it does |
|---|---|
reboot | Reboot server |
shutdown -h now | Shutdown immediately |
shutdown -r +5 | Reboot in 5 minutes |
✅ If you master just these, you’ll cover 90% of what admins do daily.
Tags:
commands
linux
ubuntu