Essential Linux Commands Cheat Sheet
File & Directory Management
ls List files in a directory
cd Change directory
pwd Print current directory
mkdir Make a new directory
rm Remove files or directories
rmdir Remove empty directories
cp Copy files or directories
mv Move or rename files/directories
touch Create empty file
find Search for files
locate Quickly find files (uses a database)
File Content & Editing
cat View file content
less, more View file content page-by-page
head Show first lines of a file
tail Show last lines of a file
nano Simple text editor
vim Powerful text editor
echo Display text or write to file
Permissions & Ownership
chmod Change file permissions
chown Change file owner
ls -l View file permissions and ownership
System Info
uname -a System info
top, htop View running processes
Essential Linux Commands Cheat Sheet
ps aux See running processes
df -h Disk space usage
du -sh Size of directory/file
free -h Memory usage
uptime System uptime
whoami Current user
id User ID and groups
Networking
ping Test network connectivity
ifconfig / ip a View network interfaces
netstat -tuln Listening ports
ss -tuln Alternative to netstat
curl Make web requests
wget Download files from the internet
telnet Test network services
nc (netcat) Read/write over network (useful for CTFs)
Package Management (Debian/Ubuntu)
apt update Update package list
apt upgrade Upgrade installed packages
apt install Install package
apt remove Remove package
Package Management (RedHat/CentOS)
yum install / dnf install Install package
yum update Update packages
File Compression & Archiving
tar -czf file.tar.gz folder Create tar.gz archive
Essential Linux Commands Cheat Sheet
tar -xzf file.tar.gz Extract tar.gz archive
zip, unzip Zip/unzip files
gzip, gunzip Compress/decompress files
User Management
adduser / useradd Add a new user
passwd Change user password
deluser / userdel Delete a user
su Switch user
sudo Run command as root
Other Useful Commands
history Show previously run commands
clear Clear the terminal screen
man <command> Manual for a command
alias Create command shortcuts
sleep Delay execution
cron, crontab -e Schedule recurring tasks