320 x 50 Mobile Ad
Cheat Sheets

Linux Commands

Transform, format, and optimize your data instantly with this free client-side tool.

File Operations

ls -la

List all files in long format including hidden files

cd /path

Change directory to /path

pwd

Print working directory

mkdir dir1

Create directory dir1

mkdir -p dir1/dir2

Create directory with parents

rm -r dir1

Remove directory and its contents recursively

rm file1

Remove file file1

cp file1 file2

Copy file1 to file2

cp -r dir1 dir2

Copy dir1 to dir2 recursively

mv -f file1 file2

Move or rename file1 to file2, forcing overwrite

touch file1

Create an empty file or update timestamp

ln -s target link

Create a symbolic link to target

stat file1

Display file or file system status

file file1

Determine file type

cat file1

Output the contents of file1

less file1

View file1 content page by page

head -n 10 file1

Output the first 10 lines of file1

tail -n 10 file1

Output the last 10 lines of file1

tail -f file1

Output appended data as file grows

Process Management

ps aux

Display all currently running processes

top

Display and manage top processes

htop

Interactive process viewer (needs install)

kill <pid>

Kill process with ID <pid>

kill -9 <pid>

Force kill process with ID <pid>

killall <proc>

Kill all processes named <proc>

pkill <name>

Kill processes based on name

bg

Resume a stopped job in the background

fg

Bring the most recent job to foreground

jobs

List active jobs

nohup cmd &

Run cmd in background immune to hangups

System Info

uname -a

Show system and kernel information

uptime

Show how long the system has been running

whoami

Display the current username

cat /etc/os-release

View OS details

free -h

Show free and used memory in human readable format

lscpu

Display CPU architecture information

lsusb

List USB devices

lspci

List PCI devices

date

Show current date and time

cal

Show this month's calendar

history

Show command history

watch -n 1 cmd

Execute a program periodically, showing output fullscreen

Network

ping <host>

Ping host and output results

ip addr show

Display all IP addresses

netstat -pnltu

Display listening ports and programs

ss -tulpn

Show listening sockets

curl -O <url>

Download a file from <url>

curl -I <url>

Fetch HTTP headers

wget <url>

Download a file from <url>

scp file1 user@host:/dir

Secure copy file1 to remote host

ssh user@host

Connect to host as user

ssh -p port user@host

Connect to host using alternative port

nmap <host>

Scan network for open ports

dig <domain>

Get DNS information for domain

traceroute <host>

Print the route packets trace to network host

Permissions

chmod 755 file1

Change permission to 755 (rwxr-xr-x)

chmod u+s file1

Set SUID bit. Allows execution as file owner

chmod +x file1

Make file1 executable

chown user:group file

Change owner and group of file

chown -R user:group dir

Change owner and group recursively

su -

Switch to root user

sudo <cmd>

Execute command as superuser

groups <user>

Show groups a user belongs to

usermod -aG group user

Add user to a group

Archives

tar -cvf arc.tar file1

Create a tar archive

tar -xvf arc.tar

Extract a tar archive

tar -zcvf arc.tar.gz dir

Create a gzip compressed tar archive

tar -zxvf arc.tar.gz

Extract a gzip compressed tar archive

unzip arc.zip

Extract a zip archive

zip -r arc.zip dir1

Create a zip archive of dir1

gzip file1

Compress file1 and rename it to file1.gz

Search & Filters

grep -r 'pattern' dir

Search recursively for pattern in dir

grep -i 'pattern' file

Search case-insensitively for pattern

find /dir -name 'str'

Find files starting from /dir matching string

find . -mtime -1

Find files modified in the last 24 hours

locate file1

Find files and directories by name (uses index)

whereis cmd

Locate the binary, source, and manual page files

which cmd

Show full path of shell commands

awk '{print $1}' file

Print the first column of each row

sed 's/foo/bar/g' file

Replace all occurrences of foo with bar

sort file | uniq -c

Count occurrences of duplicate lines

Disk Usage

df -h

Show free disk space in human readable format

df -i

Display inode usage

du -sh /dir

Estimate file space usage of directory

lsblk

List block devices

fdisk -l

List partition tables for specified devices

mount /dev/sdb1 /mnt

Mount a filesystem

umount /mnt

Unmount a filesystem

Package Management

apt update

Update list of available packages (Debian/Ubuntu)

apt upgrade

Upgrade the system by installing/upgrading packages

apt install <pkg>

Install a new package

apt remove <pkg>

Remove a package

dpkg -i pkg.deb

Install from .deb file

yum install <pkg>

Install a package (RHEL/CentOS)

dnf install <pkg>

Install a package (Fedora)

pacman -S <pkg>

Install a package (Arch Linux)

Advanced

find . -type f -exec sed -i 's/foo/bar/g' {} +

Find and replace text across all files recursively

rsync -avzP source/ user@host:/dest

Sync directories over SSH with compression and progress

journalctl -xeu service_name

View detailed systemd logs for a specific service

320 x 50 Mobile Ad

Frequently Asked Questions

Got questions? We've got answers.

The Linux Cheatsheet is a quick-reference guide that provides developers with the most essential and frequently used Linux commands, syntax, and snippets in one centralized place.
This reference is built for both beginners who are just learning Linux and need a quick syntax lookup, as well as seasoned professionals who need to jog their memory on complex commands.
You can use the real-time search bar at the top of the cheatsheet. Simply type a keyword (like &#39;delete&#39; or &#39;file&#39;) and the list will instantly filter to show only matching Linux commands.
Yes! Every command block features a one-click copy button. Just hover over the command and click the copy icon to instantly send the snippet to your clipboard.
The cheatsheet is divided into logical categories such as Basics, Network, Operations, and specific Linux features. You can click on the category filters at the top to isolate specific groups of commands.
Absolutely. This Linux reference guide is 100% free, requiring no sign-ups or subscriptions, and is always available when you need it.
While these are standard Linux operations, you should always understand what a command does before running it, especially if it involves system operations or destructive actions.
Yes, we have recently expanded this cheatsheet to include advanced snippets, best practices, and edge-case syntax that go beyond basic introductory commands.
ADVERTISEMENT
Boost Your Business Online