Common Linux Commands Cheat Sheet
File and Directory Management
ls List directory contents
cd [dir] Change current directory
pwd Print working directory
mkdir [dir] Create a new directory
rmdir [dir] Remove an empty directory
rm [file] Remove a file
rm -r [dir] Remove a directory and contents recursively
cp [src] [dest] Copy files or directories
mv [src] [dest] Move or rename files/directories
touch [file] Create an empty file
find [dir] -name [file] Search for a file/directory
File Viewing and Editing
cat [file] View file content
less [file] View file with paging
head [file] View first 10 lines
tail [file] View last 10 lines
nano [file] Open file in Nano editor
vim [file] Open file in Vim editor
echo "text" Output text to terminal
echo "text" > file Write to file (overwrite)
echo "text" >> file Append to file
User and Permissions
whoami Show current user
id Display user ID and group
chmod [mode] [file] Change file permissions
chown [user]:[group] [file] Change file owner
sudo [command] Run command as root
passwd Change password
adduser [user] Add new user
Common Linux Commands Cheat Sheet
deluser [user] Delete user
Networking
ifconfig / ip a Show network interfaces
ping [host] Send ICMP packets
netstat -tuln Show open ports
curl [url] Fetch content from URL
wget [url] Download file from URL
scp [src] [user@host]:[dest] Secure copy between hosts
ssh [user@host] Connect via SSH
Process and System Info
top Show live process usage
ps aux List running processes
kill [PID] Kill process by PID
df -h Show disk space usage
free -h Show memory usage
uname -a System info
Archiving and Compression
tar -czf file.tar.gz dir/ Create gzipped archive
tar -xzf file.tar.gz Extract gzipped archive
zip file.zip files Create zip archive
unzip file.zip Extract zip archive
Miscellaneous
history Show command history
alias ll='ls -l' Create a shortcut command
date Show current date and time
clear Clear terminal
reboot Reboot system
shutdown now Shut down immediately