Linux Commands Cheat Sheet
1. File & Directory Commands
pwd - Print current directory
ls - List files
cd - Change directory
mkdir - Make directory
rmdir - Remove empty directory
touch file.txt - Create a blank file
cp a.txt b.txt - Copy file
mv a.txt b.txt - Move/rename file
rm file.txt - Remove file
clear - Clears terminal
2. File Viewing & Editing
cat file.txt - Show file content
nano file.txt - Edit file (easy editor)
less file.txt - View file one page at a time
head file.txt - Show top lines
tail file.txt - Show bottom lines
3. Search & Find
find . -name file.txt - Find a file
grep 'word' file.txt - Search for word
locate file.txt - Fast find using DB
4. Permissions & Ownership
chmod 755 file - Change permissions
chown user file - Change file owner
ls -l - See file permissions
5. Package Management (Ubuntu/Debian)
sudo apt update - Update package list
sudo apt upgrade - Upgrade installed packages
sudo apt install packagename - Install package
sudo apt remove packagename - Uninstall package
6. System Info & Monitoring
top - Live processes
Linux Commands Cheat Sheet
htop - Better version of top (needs install)
ps aux - List all processes
df -h - Disk space (human readable)
du -sh folder/ - Folder size
free -h - RAM usage
uname -a - System info
uptime - How long system has been on
7. Compression
tar -cvf file.tar folder/ - Create .tar archive
tar -xvf file.tar - Extract .tar archive
zip -r file.zip folder/ - Zip folder
unzip file.zip - Unzip file
8. Networking
ping google.com - Test internet connection
ifconfig - Show IP address (old)
ip a - Show IP address (new)
netstat -tuln - Show listening ports
curl example.com - Fetch URL content
9. Others
history - Show previous commands
alias ll='ls -alF' - Create shortcut
man command - Show manual (help)
whoami - Show your username
sudo - Run command as admin