Complete Linux Command Cheat Sheet for Beginners 2025
⚙️ System Information
| Command | Description |
|---|
uname -a | Show system and kernel info |
hostname | Display system hostname |
uptime | Show how long the system has been running |
whoami | Show current logged-in user |
lsb_release -a | Display Linux distribution info |
arch | Show machine architecture |
top | Display running processes |
htop | Interactive process viewer (install if missing) |
free -h | Show memory usage |
df -h | Show disk space usage |
du -sh * | Show folder sizes in current directory |
vmstat | Display virtual memory stats |
lscpu | Show CPU information |
lsusb | Show connected USB devices |
lspci | Show connected PCI devices |
neofetch | Display system summary (if installed) |
📁 File and Directory Commands
| Command | Description |
|---|
pwd | Print working directory |
ls | List files |
ls -la | List all files (detailed) |
cd <dir> | Change directory |
mkdir <dir> | Create directory |
rmdir <dir> | Remove empty directory |
rm -rf <dir> | Force remove directory |
cp file1 file2 | Copy file |
cp -r dir1 dir2 | Copy directory |
mv file1 file2 | Move or rename file |
touch file.txt | Create an empty file |
cat file.txt | View file content |
less file.txt | View file one page at a time |
head -n 10 file.txt | Show first 10 lines |
tail -n 10 file.txt | Show last 10 lines |
tail -f file.txt | Follow file updates live |
find /path -name file.txt | Find files by name |
locate file.txt | Quickly locate files (uses database) |
✏️ File Editing
| Command | Description |
|---|
nano file.txt | Open file in Nano editor |
vim file.txt | Open file in Vim editor |
cat > file.txt | Create file and write text (Ctrl+D to save) |
echo "text" >> file.txt | Append text to file |
sed 's/foo/bar/g' file.txt | Replace all “foo” with “bar” |
grep "keyword" file.txt | Search keyword in file |
grep -r "keyword" /path | Search recursively |
awk '{print $1}' file.txt | Print first column |
sort file.txt | Sort lines |
uniq file.txt | Remove duplicate lines |
diff file1 file2 | Compare two files |
🔐 User Management
| Command | Description |
|---|
who | Show logged-in users |
w | Show user sessions |
id | Show user ID info |
adduser username | Add new user |
passwd username | Change password |
deluser username | Delete user |
usermod -aG group username | Add user to group |
groups | Show user groups |
su - username | Switch user |
sudo <command> | Run command as root |
📦 Package Management
Debian/Ubuntu
| 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 |
dpkg -l | List installed packages |
RHEL/CentOS/Fedora
| Command | Description |
|---|
sudo dnf install <pkg> | Install package |
sudo dnf remove <pkg> | Remove package |
sudo yum update | Update system |
rpm -qa | List installed packages |
🧰 Process Management
| Command | Description |
|---|
ps aux | Show all running processes |
pgrep <process> | Find process ID |
kill <pid> | Kill a process |
kill -9 <pid> | Force kill a process |
pkill <process> | Kill process by name |
jobs | List background jobs |
bg %1 | Resume job in background |
fg %1 | Resume job in foreground |
🌐 Networking
| Command | Description |
|---|
ip a | Show IP addresses |
ifconfig | Show network interfaces |
ping google.com | Test network connection |
netstat -tulnp | Show active ports |
ss -tuln | Show listening sockets |
curl -I website.com | Check website headers |
wget <url> | Download file |
scp file user@host:/path | Secure copy to remote |
ssh user@host | Connect to remote server |
traceroute <host> | Trace route |
nslookup <domain> | DNS lookup |
dig <domain> | Advanced DNS lookup |
🔥 Disk and Storage
| Command | Description |
|---|
lsblk | List block devices |
fdisk -l | List disk partitions |
mount /dev/sdb1 /mnt | Mount disk |
umount /mnt | Unmount disk |
blkid | Show disk UUIDs |
df -Th | Show file system types and usage |
du -sh * | Show size of each item in folder |
🧾 Permissions
| Command | Description |
|---|
chmod 755 file | Change file permissions |
chown user:group file | Change file owner |
ls -l | Show file permissions |
umask | View or set default permissions |
sudo | Run command with root privileges |
🧮 System Monitoring
| Command | Description |
|---|
top | Show system processes |
htop | Better system monitor |
iostat | Show CPU and I/O stats |
vmstat | Show memory and process info |
sar -u 1 3 | Display CPU usage every second |
watch -n 1 free -h | Watch live memory usage |
💾 Backup and Compression
| Command | Description |
|---|
tar -cvf backup.tar /folder | Create tar archive |
tar -xvf backup.tar | Extract tar archive |
gzip file | Compress file |
gunzip file.gz | Decompress file |
zip -r backup.zip /folder | Create zip file |
unzip backup.zip | Extract zip file |
rsync -av source/ dest/ | Sync/backup directories |
🧑💻 System Services
| Command | Description |
|---|
systemctl status service | Check service status |
systemctl start service | Start service |
systemctl stop service | Stop service |
systemctl restart service | Restart service |
systemctl enable service | Enable service at boot |
systemctl disable service | Disable service |
🧱 File Permissions Codes (Quick Reference)
| Code | Meaning |
|---|
r | Read |
w | Write |
x | Execute |
4 | Read permission |
2 | Write permission |
1 | Execute permission |
Example: chmod 755 file = rwxr-xr-x | |
🧠 Shortcuts & Tricks
| Command | Description |
|---|
!! | Run last command again |
!<command> | Run last <command> (e.g., !ls) |
history | Show recent commands |
clear | Clear terminal screen |
Ctrl + C | Stop running process |
Ctrl + D | Logout or end input |
Ctrl + R | Search command history |
Follow http://www.fixmyai.in for more real-world AI and automation guides written by professionals who’ve actually tested them. 🚀