Linux Commands Cheat Sheet
Basic Commands
pwd - Print current directory (path)
ls - List files and directories
cd - Change directory
mkdir - Create a new directory
rmdir - Remove an empty directory
touch file.txt - Create an empty file
rm file.txt - Remove a file
cp source dest - Copy files/directories
mv old new - Rename or move files/directories
clear - Clear terminal screen
File Viewing
cat file.txt - View file contents
more file.txt - View one page at a time
less file.txt - Like `more`, but with scroll back
head -n 10 file.txt - First 10 lines
tail -n 10 file.txt - Last 10 lines
File Permissions
chmod - Change permissions
chown - Change owner
ls -l - Show detailed file info with permissions
System Info
uname -a - Kernel name, version, etc.
top or htop - Show running processes
df -h - Disk usage
free -h - Memory usage
uptime - System uptime
whoami - Current user
hostname - System's hostname
Process Management
ps - Show running processes
kill PID - Kill process by PID
killall name - Kill process by name
bg / fg - Background/foreground jobs
Networking
ping google.com - Test internet connection
ifconfig / ip a - Show IP addresses
netstat -tuln - Show open ports
curl or wget - Download files from the web