🐧 Ultimate Linux Command Cheat Sheet (2025 Edition)
A Complete Beginner’s Guide with Commands, Explanations, and Examples
Linux is one of the most powerful and flexible operating systems in the world — and it’s built around the command line.
Whether you’re a developer, sysadmin, or DevOps engineer, mastering these commands will help you control your system efficiently.
Here’s a categorized, easy-to-read list of essential Linux commands with basic definitions and examples.
🧭 1. System Information Commands
Use these commands to check details about your Linux system — kernel version, CPU, memory, and more.
uname -a # Show system info (kernel, architecture)
hostname # Show or set hostname
uptime # Show how long the system has been running
whoami # Show current username
top # Display running processes
htop # Interactive process viewer (sudo apt install htop)
free -h # Display memory usage
df -h # Show disk usage
du -sh * # Show folder sizes
lsblk # List block devices
cat /etc/os-release # Show Linux distro info
📁 2. File & Directory Management
These are the core commands to navigate, create, copy, move, and delete files or directories.
pwd # Print current working directory
ls # List files
ls -la # List all files (including hidden)
cd /path # Change directory
mkdir folder # Create directory
rmdir folder # Remove directory
cp file1 file2 # Copy file
cp -r dir1 dir2 # Copy directory
mv file1 file2 # Move or rename file
rm file # Remove file
rm -rf folder # Force remove directory
nano file # Update file
touch file # Create empty file
cat file # Show file contents
less file # View file page-by-page
head file # First 10 lines
tail file # Last 10 lines
tail -f logfile # Watch live logs
🔍 3. Search & Filter Commands
Use these commands to find files or search for specific text patterns inside files.
find / -name filename # Find file by name
grep "text" file # Search for text in a file
grep -r "text" /path # Search recursively
grep -i "text" # Case-insensitive search
sort file # Sort lines alphabetically
uniq file # Remove duplicate lines
wc -l file # Count number of lines
cut -d':' -f1 file # Extract first field
awk '{print $1}' file # Print first column
sed 's/foo/bar/g' file # Replace text
👤 4. User Management Commands
Manage users, passwords, and groups with these simple commands.
adduser username # Add new user
passwd username # Change password
deluser username # Delete user
usermod -aG group username # Add user to group
groups username # Show user groups
id username # Display UID, GID info
sudo su - username # Switch user
🔐 5. File Permission Commands
Control who can read, write, or execute files and directories.
ls -l # Show permissions
chmod 755 file # Change file permission
chown user:group file # Change ownership
umask # View default permission mask
⚙️ 6. Process Management
Manage running processes, jobs, and priorities in Linux.
ps aux # Show all processes
top # Real-time process view
kill PID # Kill process by ID
killall process_name # Kill all instances by name
nice # Start process with priority
renice # Change process priority
jobs # Show background jobs
bg %1 # Resume job in background
fg %1 # Bring job to foreground
🌐 7. Networking Commands
Test connectivity, check interfaces, and transfer files over the network.
ip a # Show IP addresses
ifconfig # Show network interfaces
ping 8.8.8.8 # Test internet connection
curl https://example.com # Fetch webpage
wget URL # Download file
netstat -tulnp # Show open ports
ss -tulwn # Modern replacement for netstat
nslookup domain.com # DNS lookup
traceroute host # Trace route
scp file user@server:/path # Copy files over SSH
rsync -avz /src/ user@host:/dest/ # Sync files
📦 8. Package Management
🟩 Debian / Ubuntu (APT)
sudo apt update # Update package list
sudo apt upgrade # Upgrade all packages
sudo apt install package # Install package
sudo apt remove package # Remove package
sudo apt autoremove # Clean unused packages
apt list --installed # List installed packages
🟧 RHEL / CentOS (YUM / DNF)
sudo yum install package
sudo dnf update
sudo yum remove package
📂 9. Compression & Archiving
Compress and extract files easily using tar and zip utilities.
tar -cvf file.tar folder/ # Create tar archive
tar -xvf file.tar # Extract tar
tar -czvf file.tar.gz folder # Create gzip archive
tar -xzvf file.tar.gz # Extract gzip
zip -r file.zip folder/ # Create zip
unzip file.zip # Extract zip
🔄 10. System Control & Power Commands
Shut down, reboot, and manage terminal history.
reboot # Restart system
shutdown now # Power off
shutdown -r now # Reboot immediately
history # View command history
clear # Clear terminal
🧰 11. Disk & File System Management
Manage storage devices, partitions, and mounts.
mount /dev/sdb1 /mnt # Mount device
umount /mnt # Unmount device
fdisk -l # List partitions
mkfs.ext4 /dev/sdb1 # Format disk
fsck /dev/sdb1 # Check filesystem
🧾 12. Logs & Monitoring
Monitor system logs to troubleshoot or analyze performance.
dmesg | less # Kernel messages
journalctl -xe # System logs
tail -f /var/log/syslog # Live system logs
tail -f /var/log/nginx/error.log # Nginx error logs
⌨️ 13. Keyboard Shortcuts
| Shortcut | Description |
|---|---|
Ctrl + C |
Stop running process |
Ctrl + D |
Logout or exit shell |
Ctrl + L |
Clear terminal screen |
!! |
Repeat last command |
history | grep text |
Search command history |
💡 Conclusion
Linux can seem overwhelming at first, but once you start practicing these commands daily, you’ll quickly gain confidence.
You’ll be able to manage files, users, and servers like a pro.
Pro Tip: Learn 5 new commands every day. Within a week, you’ll start using them without even thinking.
