My Ultimate Linux/Ubuntu Commands Cheat (2025)
Whether you’re a beginner or an experienced sysadmin, using the Linux command line efficiently is a core skill. This comprehensive Linux/Ubuntu cheat sheet is designed to help you find the right command faster, grouped by category for everyday usage – from file management to networking, services, scripting, and more.
Bookmark it, print it, or save it – and make your terminal life easier.
File and Directory Management
Navigating the filesystem and organizing files is one of the most frequent tasks in Linux. These commands will help you move around, create, delete, and search files and directories with ease.
| Command | Description |
|---|---|
ls | List files and directories. |
ls -l | Long listing format. |
ls -a | Include hidden files. |
cd /path | Change directory. |
cd .. | Move up one level. |
pwd | Print current working directory. |
mkdir name | Create a new directory. |
mkdir -p /a/b/c | Create nested directories. |
rm file | Remove a file. |
rm -r folder | Remove a directory and its contents. |
cp source dest | Copy file. |
cp -r dir1 dir2 | Copy directories recursively. |
mv source dest | Move or rename file/directory. |
touch file | Create empty file or update timestamp. |
find . -name "*.log" | Find files by name. |
tree | Display directory tree (requires install). |
du -sh * | Show folder sizes in human-readable format. |
df -h | Disk space usage in human-readable format. |
Related tutorials you may find useful:
- Find and Execute Commands on Found Files
- Move, Remove, and Copy Files and Directories (mv, rm, cp)
- Create and View Files (touch, cat, less, find)
- Navigation and Directory Management (cd, pwd, mkdir)
Permissions and Ownership
Controlling who can read, write, or execute a file is critical in multi-user systems. These commands help manage file and directory access rights.
| Command | Description |
|---|---|
chmod 755 file | Set file permissions. |
chmod -R 755 dir | Set permissions recursively. |
chown user file | Change file ownership. |
chown user:group f | Change user and group ownership. |
stat file | View file permission details. |
umask | Show default permissions for new files. |
Related tutorials you may find useful:
Package Management (APT)
Keeping your system up-to-date or installing new tools? These are the go-to commands for managing software packages on Ubuntu-based systems.
| Command | Description |
|---|---|
sudo apt update | Update package list. |
sudo apt upgrade | Upgrade all packages. |
sudo apt install pkg | Install package. |
sudo apt remove pkg | Remove package. |
sudo apt autoremove | Remove unused dependencies. |
dpkg -i file.deb | Install a .deb package manually. |
apt-mark showmanual | List manually installed packages. |
snap list | List Snap packages. |
snap install <package> | Install Snap package. |
Related tutorials you may find useful:
- How to Remove Applications Using apt-get from an Ubuntu Server
- How to Remove Applications from an Ubuntu Server Using dpkg
- Remove Applications from Ubuntu Server Using Snap
- How to Remove an Application from an Ubuntu Server Manually
User and Group Management
Every Linux system involves managing users and permissions. Here’s how to add, modify, and remove users and groups.
| Command | Description |
|---|---|
adduser user | Add a new user. |
passwd user | Set/change user password. |
usermod -aG group user | Add user to group. |
groups user | Show user’s groups. |
id user | Display UID, GID, groups. |
deluser user | Delete user. |
groupadd group | Add a new group. |
System Monitoring and Performance
Need to check memory usage or find what’s eating up CPU? These commands provide real-time system performance metrics.
| Command | Description |
|---|---|
top | Live system monitor. |
htop | Enhanced interactive monitor (install separately). |
ps aux | View all running processes. |
free -h | Show memory usage. |
uptime | Show system uptime and load average. |
vmstat | Report system performance. |
iostat | Report CPU/disk stats. Requires sysstat package. |
watch <cmd> | Repeat a command every 2 seconds. |
Monitoring your system’s performance is key to ensuring stability and identifying issues before they impact uptime. Tools like htop, atop, nload, and iostat offer real-time insights into resource usage, helping administrators quickly detect and resolve problems.
Recommended reading:
Networking
From checking IP addresses to DNS lookups, these commands help you understand and troubleshoot your system’s network configuration.
| Command | Description |
|---|---|
ip a | Show IP addresses. |
ip r | Show routing table. |
ping host | Send ICMP packets to host. |
traceroute host | Show route to host. |
netstat -tulnp | Show listening ports (deprecated in favor of ss). |
ss -tuln | Show active listening sockets. |
curl url | Fetch web content. |
wget url | Download file from web. |
dig domain | DNS lookup. |
nslookup domain | DNS query (older tool). |
Linux provides robust tools for configuring, monitoring, and troubleshooting network interfaces and services. Understanding how to manage interfaces, analyze active ports, and work with modern tools like Netplan is essential for any system administrator.
Recommended reading:
- Linux Networking: Display Listening Ports and Listening Services
- Linux Networking: ifconfig – Managing Network Interfaces on Ubuntu
- Linux Networking: Netplan DHCP Configuration
Process Management
Sometimes you need to check, stop, or prioritize running processes. These commands let you manage what’s running on your system.
| Command | Description |
|---|---|
ps aux | List all running processes. |
kill PID | Kill process by PID. |
killall name | Kill all processes with the given name. |
nice -n 10 cmd | Run command with adjusted priority. |
renice PID | Change priority of running process. |
jobs | List background jobs. |
bg, fg | Resume jobs in background/foreground. |
Recommended reading:
- Linux Process: List All Running Services with ps Command
- Ubuntu Process Management: Kill Command
- How to Kill All Processes Using wget on Linux
Disk and Filesystem
Keep your storage under control with these commands for managing partitions, mounting, and checking space usage.
| Command | Description |
|---|---|
lsblk | List block devices. |
mount /dev/sdX /mnt | Mount device. |
umount /mnt | Unmount device. |
blkid | Display block device attributes. |
fdisk -l | List partitions. |
mkfs.ext4 /dev/sdX | Format partition as ext4. |
tune2fs | Modify ext2/ext3/ext4 filesystem parameters. |
Recommended reading:
Service Management (systemd)
Services (daemons) are core components in Linux. Use these commands to control background services on systemd-based systems.
| Command | Description |
|---|---|
systemctl start service | Start a service. |
systemctl stop service | Stop a service. |
systemctl restart service | Restart a service. |
systemctl status service | Show service status. |
systemctl enable service | Enable service at boot. |
systemctl disable service | Disable service from autostart. |
journalctl -xe | Show detailed logs. |
Logs and Troubleshooting
Logs are your best friends when diagnosing system issues. These commands will help you inspect logs and track down errors.
| Command | Description |
|---|---|
journalctl -xe | Show system logs with extra detail. |
dmesg | Kernel ring buffer (boot and device logs). |
tail -f /var/log/syslog | Live log tailing. |
less /var/log/auth.log | View login-related logs. |
grep "error" logfile | Search for errors in a log file. |
Scheduled Tasks
Automating tasks is easy in Linux. Use cron and systemd timers to schedule scripts or commands.
| Command | Description |
|---|---|
crontab -e | Edit current user’s crontab. |
crontab -l | List cron jobs. |
at 10:00 | Run a one-time command at a specified time. |
systemctl list-timers | Show systemd timers. |
SSH and Remote Access
Securely access and manage remote systems using SSH. These commands cover key generation, file transfer, and connections.
| Command | Description |
|---|---|
ssh user@host | Connect to remote system. |
scp file user@host:/path | Copy file over SSH. |
rsync -avz src/ user@host:/path | Sync files over SSH. |
ssh-keygen | Generate SSH key pair. |
ssh-copy-id user@host | Copy SSH key to remote host. |
Recommended reading:
Compression and Archiving
Need to archive or compress files? These are essential tools for working with .tar, .zip, and other compressed formats.
| Command | Description |
|---|---|
tar -czf archive.tar.gz dir | Create a compressed archive. |
tar -xzf archive.tar.gz | Extract a .tar.gz archive. |
zip -r archive.zip dir | Create a .zip archive. |
unzip archive.zip | Extract .zip file. |
gzip file | Compress a file. |
gunzip file.gz | Decompress a file. |
Text Processing and Search
Linux shines in text manipulation. With these commands, you can filter, search, and reformat text from files or input.
| Command | Description |
|---|---|
cat file | Display file contents. |
less file | View large files with navigation. |
head -n 10 file | Show first 10 lines. |
tail -n 10 file | Show last 10 lines. |
grep "word" file | Search for word in file. |
cut -d':' -f1 /etc/passwd | Extract fields using delimiter. |
awk '{print $1}' | Print column with awk. |
sed 's/foo/bar/g' | Replace text using sed. |
Recommended reading:
Scripting and Automation
Automate repetitive tasks using shell scripts. These basic scripting examples will help you get started.
| Syntax/Command | Description |
|---|---|
#!/bin/bash | Define script interpreter. |
for i in {1..5}; do ...; done | Simple loop. |
if [ -f file ]; then ...; fi | File existence check. |
chmod +x script.sh | Make script executable. |
./script.sh | Run the script. |
System Information
Quickly gather system specs, user sessions, and OS version using these handy commands.
| Command | Description |
|---|---|
uname -a | Kernel version and architecture. |
lsb_release -a | Ubuntu version info. |
hostnamectl | Show hostname and OS details. |
who | List logged in users. |
last | Show login history. |
Conclusion
This Linux/Ubuntu cheat sheet includes the most useful and commonly used commands to manage your system efficiently. Whether you’re maintaining servers, developing applications, or just learning Linux, having quick access to the right commands can save you time and effort.
Bookmark this page or export it to PDF/Word for offline use.
Want more advanced tips? Stay tuned for upcoming articles on Bash scripting, security hardening, and automation.











