Linux Cheatsheet

Linux Cheatsheet
ls

List directory contents

Files
ls -la

List all files with details (including hidden)

Files
cd <dir>

Change directory

Files
pwd

Print current working directory

Files
mkdir <dir>

Create a directory

Files
mkdir -p a/b/c

Create nested directories

Files
rm <file>

Remove a file

Files
rm -rf <dir>

Remove directory recursively (careful!)

Files
cp <src> <dst>

Copy file

Files
cp -r <src> <dst>

Copy directory recursively

Files
mv <src> <dst>

Move or rename file/directory

Files
touch <file>

Create empty file or update timestamp

Files
cat <file>

Display file contents

Files
head -n 20 <file>

Show first 20 lines

Files
tail -n 20 <file>

Show last 20 lines

Files
tail -f <file>

Follow file output in real time

Files
ln -s <target> <link>

Create symbolic link

Files
stat <file>

Show detailed file information

Files
chmod 755 <file>

Set permissions (rwxr-xr-x)

Permissions
chmod +x <file>

Make file executable

Permissions
chmod -R 644 <dir>

Set permissions recursively

Permissions
chown user:group <file>

Change file owner and group

Permissions
chown -R user:group <dir>

Change owner recursively

Permissions
umask 022

Set default permission mask

Permissions
find . -name "*.txt"

Find files by name pattern

Search
find . -type f -mtime -7

Find files modified in last 7 days

Search
find . -size +100M

Find files larger than 100MB

Search
grep "pattern" <file>

Search for pattern in file

Search
grep -r "pattern" <dir>

Search recursively in directory

Search
grep -i "pattern" <file>

Case-insensitive search

Search
grep -n "pattern" <file>

Search with line numbers

Search
which <cmd>

Show full path of a command

Search
locate <file>

Find file by name (uses database)

Search
curl <url>

Transfer data from URL

Network
curl -O <url>

Download file from URL

Network
wget <url>

Download file

Network
ping <host>

Test network connectivity

Network
ip addr

Show network interfaces and IPs

Network
ss -tuln

Show listening ports

Network
netstat -tuln

Show listening ports (legacy)

Network
scp <file> user@host:<path>

Copy file to remote host via SSH

Network
ssh user@host

Connect to remote host via SSH

Network
rsync -avz <src> <dst>

Sync files/directories efficiently

Network
ps aux

List all running processes

Processes
ps aux | grep <name>

Find process by name

Processes
top

Interactive process monitor

Processes
htop

Better interactive process monitor

Processes
kill <pid>

Send SIGTERM to process

Processes
kill -9 <pid>

Force kill process (SIGKILL)

Processes
killall <name>

Kill all processes by name

Processes
bg

Resume suspended job in background

Processes
fg

Bring background job to foreground

Processes
nohup <cmd> &

Run command immune to hangups

Processes
df -h

Show disk space usage (human-readable)

Disk
du -sh <dir>

Show directory size

Disk
du -sh * | sort -rh

List items by size (largest first)

Disk
mount

Show mounted filesystems

Disk
lsblk

List block devices

Disk
fdisk -l

List disk partitions

Disk
uname -a

Show system information

System
hostname

Show or set system hostname

System
uptime

Show how long system has been running

System
whoami

Show current username

System
date

Show current date and time

System
cal

Show calendar

System
free -h

Show memory usage

System
systemctl status <service>

Check service status

System
systemctl restart <service>

Restart a service

System
journalctl -u <service> -f

Follow service logs

System
history

Show command history

System
alias ll='ls -la'

Create a command alias

System
env

Show environment variables

System
export VAR=value

Set environment variable

System
tar czf archive.tar.gz <dir>

Create gzip compressed archive

Archives
tar xzf archive.tar.gz

Extract gzip archive

Archives
tar xjf archive.tar.bz2

Extract bzip2 archive

Archives
zip -r archive.zip <dir>

Create zip archive

Archives
unzip archive.zip

Extract zip archive

Archives
gzip <file>

Compress file with gzip

Archives
gunzip <file>.gz

Decompress gzip file

Archives
Showing 80 of 80 commands

Linux Commands Cheatsheet

A comprehensive, searchable reference of essential Linux commands. Filter by category (files, permissions, search, network, processes, disk, system, archives) or search by keyword. Copy any command with one click.

About this cheatsheet

This Linux cheatsheet covers the most commonly used terminal commands organized by task category.

  • 75+ essential Linux commands
  • Filter by category (Files, Permissions, Search, Network, Processes, Disk, System, Archives)
  • Full-text search across commands and descriptions
  • One-click copy to clipboard
  • Works offline — all data is in the page

100% free. No signup required. No data collected or sent anywhere.

Explore All Tools