pwdPrint the current directory
A massive searchable, copy-ready reference for Linux students, technicians, homelab users, and sysadmins.
cat file.txtPrint a file
tac file.txtPrint lines in reverse order
less file.txtView a file page by page
more file.txtSimple paged file viewer
head file.txtShow the first 10 lines
head -n 25 file.txtShow the first 25 lines
tail file.txtShow the last 10 lines
tail -f /var/log/syslogFollow a growing log file
nano file.txtEdit with Nano
vim file.txtEdit with Vim
wc -l file.txtCount lines
wc -w file.txtCount words
nl file.txtShow line numbers
column -t file.txtAlign whitespace-separated columns
strings binaryfileExtract printable strings from a binary
xxd fileHex dump a file
grep 'text' file.txtSearch for text
grep -i 'text' file.txtCase-insensitive search
grep -R 'text' /pathRecursive search
grep -n 'text' file.txtShow matching line numbers
grep -v 'text' file.txtShow nonmatching lines
grep -E 'catdog' file.txt|Extended regex search
cut -d: -f1 /etc/passwdExtract the first colon-delimited field
sort file.txtSort lines alphabetically
sort -n numbers.txtSort numerically
uniq file.txtRemove adjacent duplicates
sort file.txtuniq -c|Count repeated lines
tr 'a-z' 'A-Z' < file.txtConvert lowercase to uppercase
sed 's/old/new/g' file.txtReplace text in output
sed -i 's/old/new/g' file.txtReplace text in place
awk '{print $1}' file.txtPrint the first field
awk -F: '{print $1}' /etc/passwdPrint the first colon-delimited field
paste file1 file2Merge files side by side
comm file1 file2Compare two sorted files
diff -u old.txt new.txtShow a unified diff
xargs -n1 echo < file.txtBuild command arguments from stdin
ls -lShow Unix permissions and ownership
chmod 644 file.txtSet rw-r--r--
chmod 755 script.shSet rwxr-xr-x
chmod +x script.shAdd execute permission
chmod -R 750 directoryChange permissions recursively
chown user file.txtChange owner
chown user:group file.txtChange owner and group
chown -R user:group directoryChange ownership recursively
chgrp group file.txtChange group ownership
umaskShow current creation mask
umask 022Set a common creation mask
getfacl file.txtDisplay ACL permissions
setfacl -m u:alice:rw file.txtGrant ACL permissions to a user
whoamiPrint current username
idShow UID GID and groups
id usernameShow another user's identity information
whoShow logged-in users
wShow logged-in users and activity
lastShow login history
usersPrint logged-in usernames
sudo commandRun a command with elevated privileges
sudo -iOpen a root login shell
su - usernameSwitch to another user
useradd -m usernameCreate a user and home directory
adduser usernameInteractive user creation on Debian or Ubuntu
passwd usernameSet or change a password
usermod -aG sudo usernameAdd a user to sudo group
usermod -aG group usernameAdd a user to a supplementary group
groups usernameShow group memberships
groupadd groupnameCreate a group
userdel -r usernameDelete a user and home directory ⚠
getent passwd usernameQuery account information
psShow processes in the current shell
ps auxShow all processes
ps -efShow all processes in full format
topInteractive process monitor
htopEnhanced interactive process monitor
pgrep nginxFind PIDs by name
pidof sshdPrint PID of a program
kill PIDSend SIGTERM
kill -9 PIDForce-kill with SIGKILL
pkill nginxKill processes by name
killall processnameKill all matching processes
nice -n 10 commandStart with adjusted priority
renice 5 -p PIDChange priority of a running process
jobsList shell jobs
command &Run a command in the background
fg %1Bring job 1 to foreground
bg %1Resume job 1 in background
nohup command &Keep a command running after logout
watch -n 2 commandRepeat a command every 2 seconds
time commandMeasure execution time
uname -aShow kernel and architecture information
uname -rShow kernel version
hostnameShow hostname
hostnamectlShow hostname and system metadata
cat /etc/os-releaseShow Linux distribution information
lsb_release -aShow distribution details if installed
uptimeShow uptime and load averages
dateShow current date and time
timedatectlShow time configuration
calDisplay a calendar
archShow machine architecture
lscpuShow CPU information
free -hShow memory usage
vmstatShow memory CPU and process statistics
lsmemShow memory block information
dmidecodeShow SMBIOS hardware information
lspciList PCI devices
lsusbList USB devices
sensorsShow hardware temperatures if configured
df -hShow filesystem disk usage
df -iShow inode usage
du -sh directoryShow total size of a directory
du -h --max-depth=1Show one-level directory sizes
lsblkList block devices
lsblk -fShow filesystems on block devices
blkidShow UUIDs and filesystem types
fdisk -lList partition tables
parted -lList partitions with GNU Parted
mountShow mounted filesystems
mount /dev/sdb1 /mntMount a filesystem
umount /mntUnmount a filesystem
findmntShow mounted filesystems as a tree
fsck /dev/sdXNCheck or repair an unmounted filesystem ⚠
mkfs.ext4 /dev/sdXNCreate an ext4 filesystem and erase existing filesystem data ⚠
mkswap /dev/sdXNCreate swap space ⚠
swapon --showShow active swap
swapon /swapfileEnable swap
swapoff /swapfileDisable swap
syncFlush filesystem buffers
ip addrShow interfaces and IP addresses
ip -br addrBrief interface and address view
ip linkShow link state
ip routeShow routing table
ip neighShow neighbor or ARP table
hostname -IShow host IP addresses
ping 8.8.8.8Test IP connectivity
ping -c 4 example.comSend four ICMP requests
traceroute example.comTrace the network path
tracepath example.comTrace path without raw-socket privileges
ss -tulpnShow listening TCP and UDP sockets
ss -tanShow TCP connections
netstat -tulpnLegacy socket and listener view
curl https://example.comFetch a URL
curl -I https://example.comFetch HTTP headers
curl -O https://example.com/file.isoDownload using the remote filename
wget https://example.com/file.isoDownload a file
dig example.comQuery DNS
dig +short example.comConcise DNS query
nslookup example.comSimple DNS lookup
host example.comDNS lookup with host
resolvectl statusShow systemd-resolved status
nmcli device statusShow NetworkManager devices
nmcli connection showList NetworkManager connections
ethtool eth0Show Ethernet link details
ssh user@serverConnect to a remote host
ssh -p 2222 user@serverSSH on a custom port
ssh-keygen -t ed25519Generate an Ed25519 SSH key
ssh-copy-id user@serverInstall your public key remotely
scp file user@server:/path/Copy a file to a remote host
scp user@server:/path/file .Copy a remote file locally
scp -r directory user@server:/path/Copy a directory over SSH
sftp user@serverOpen an SFTP session
rsync -av source/ dest/Synchronize directories locally
rsync -avz source/ user@server:/path/Synchronize to a remote host
ssh -L 8080:localhost:80 user@serverCreate a local SSH port forward
systemctl status sshShow service status
systemctl start sshStart a service
systemctl stop sshStop a service
systemctl restart sshRestart a service
systemctl reload nginxReload service configuration if supported
systemctl enable sshEnable a service at boot
systemctl disable sshDisable a service at boot
systemctl enable --now sshEnable and start immediately
systemctl list-units --type=serviceList loaded services
systemctl list-unit-filesList installed unit files
systemctl daemon-reloadReload systemd unit definitions
systemctl is-active sshCheck whether a service is active
systemctl is-enabled sshCheck whether a service starts at boot
systemctl rebootReboot the system
systemctl poweroffPower off the system
journalctlView the systemd journal
journalctl -bShow logs from current boot
journalctl -b -1Show logs from previous boot
journalctl -u sshShow logs for a service
journalctl -u nginx -fFollow service logs
journalctl -p errShow error-priority messages
journalctl --since '1 hour ago'Show recent logs
dmesgShow kernel messages
dmesg -TShow kernel messages with readable timestamps
tail -f /var/log/syslogFollow Ubuntu or Debian system log
tail -f /var/log/messagesFollow common RHEL-family system log
lastbShow failed login attempts where supported
sudo apt updateRefresh package indexes
sudo apt upgradeUpgrade installed packages
sudo apt full-upgradeUpgrade allowing dependency changes
sudo apt install packageInstall a package
sudo apt remove packageRemove a package
sudo apt purge packageRemove package and configuration
sudo apt autoremoveRemove unused dependencies
apt search keywordSearch packages
apt show packageShow package information
dpkg -lList installed Debian packages
dpkg -L packageList files installed by a package
sudo dpkg -i file.debInstall a local DEB package
sudo dnf check-updateCheck for updates
sudo dnf upgradeUpgrade installed packages
sudo dnf install packageInstall a package
sudo dnf remove packageRemove a package
dnf search keywordSearch packages
dnf info packageShow package information
rpm -qaList installed RPM packages
rpm -ql packageList files from an installed RPM package
sudo pacman -SyuUpdate repositories and upgrade the system
sudo pacman -S packageInstall a package
sudo pacman -R packageRemove a package
sudo pacman -Rs packageRemove a package and unneeded dependencies
pacman -Ss keywordSearch repositories
pacman -Qi packageShow installed package information
tar -czf archive.tar.gz directory/Create a gzip-compressed tar archive
tar -xzf archive.tar.gzExtract a tar.gz archive
tar -cJf archive.tar.xz directory/Create an xz-compressed tar archive
tar -xJf archive.tar.xzExtract a tar.xz archive
tar -tf archive.tar.gzList archive contents
zip -r archive.zip directory/Create a ZIP archive
unzip archive.zipExtract a ZIP archive
gzip fileCompress to file.gz
gunzip file.gzDecompress gzip
xz fileCompress with xz
unxz file.xzDecompress xz
7z a archive.7z directory/Create a 7-Zip archive
7z x archive.7zExtract a 7-Zip archive
echo $PATHPrint executable search path
envShow environment variables
printenvPrint environment variables
export VAR=valueSet an environment variable
unset VARRemove an environment variable
historyShow shell history
historygrep ssh|Search shell history
!!Run the previous command again
!123Run history entry 123
alias ll='ls -lah'Create a temporary alias
unalias llRemove an alias
which python3Locate an executable
command -v python3Portable command lookup
type cdDescribe how a command name is interpreted
source ~/.bashrcReload Bash configuration
bash script.shRun a Bash script
./script.shRun an executable script from current directory
command > file.txtRedirect stdout and overwrite
command >> file.txtAppend stdout
command 2> errors.txtRedirect stderr
command > out.txt 2>&1Redirect stdout and stderr together
command1command2|Pipe output into another command
commandtee file.txt|Display and save output
commandtee -a file.txt|Display and append output
command < input.txtUse a file as stdin
cmd1 && cmd2Run cmd2 only if cmd1 succeeds
cmd1| cmd2|Run cmd2 only if cmd1 fails
cmd1 ; cmd2Run sequentially regardless of status
dd if=input.img of=output.img bs=4M status=progressCopy an image or file with progress
dd if=/dev/sdX of=disk.img bs=4M status=progressCreate a raw disk image ⚠
dd if=disk.img of=/dev/sdX bs=4M status=progressWrite a raw image to a disk ⚠
crontab -eEdit current user's cron jobs
crontab -lList current user's cron jobs
sudo crontab -eEdit root's cron jobs
at 17:00Schedule a one-time job for 5 PM
atqList queued at jobs
atrm JOBIDRemove a queued at job
systemctl list-timersList systemd timers
sudo ufw statusShow UFW status
sudo ufw enableEnable UFW
sudo ufw allow 22/tcpAllow TCP port 22
sudo ufw deny 23/tcpDeny TCP port 23
sudo ufw delete allow 22/tcpDelete an allow rule
sudo firewall-cmd --stateCheck firewalld status
sudo firewall-cmd --list-allShow active firewalld rules
sudo firewall-cmd --add-service=http --permanentPermanently allow HTTP
sudo firewall-cmd --reloadReload firewalld
sudo nft list rulesetDisplay nftables rules
docker versionShow Docker versions
docker infoShow Docker engine information
docker psList running containers
docker ps -aList all containers
docker imagesList local images
docker pull nginxDownload an image
docker run --name web -p 8080:80 -d nginxRun nginx in the background
docker stop webStop a container
docker start webStart a stopped container
docker restart webRestart a container
docker rm webRemove a stopped container
docker rmi nginxRemove an image
docker logs webShow container logs
docker logs -f webFollow container logs
docker exec -it web bashOpen a Bash shell inside a container
docker inspect webShow detailed metadata
docker statsShow live resource usage
docker volume lsList volumes
docker network lsList networks
docker compose up -dStart a Compose project
docker compose downStop and remove Compose resources
docker compose logs -fFollow Compose logs
git initInitialize a repository
git clone URLClone a remote repository
git statusShow repository status
git add fileStage a file
git add .Stage changes under the current directory
git commit -m 'message'Create a commit
git log --oneline --graph --decorateShow a compact commit graph
git diffShow unstaged changes
git diff --stagedShow staged changes
git branchList branches
git switch branchSwitch branches
git switch -c newbranchCreate and switch branches
git merge branchMerge a branch
git pullFetch and integrate remote changes
git pushPush commits
git remote -vShow remotes
lspci -nnList PCI devices with numeric IDs
lsusb -vShow verbose USB information
lsmodList loaded kernel modules
modinfo moduleShow module information
sudo modprobe moduleLoad a kernel module
sudo modprobe -r moduleUnload a kernel module
udevadm info /dev/sdaQuery udev device information
smartctl -a /dev/sdaShow SMART disk health
nvme listList NVMe devices
nvme smart-log /dev/nvme0Show NVMe health information
topLive process and resource view
htopEnhanced process monitor
free -hMemory and swap usage
vmstat 1Sample memory and CPU every second
iostat -xz 1Detailed disk I/O statistics
iotopShow processes performing disk I/O
mpstat -P ALL 1Show per-CPU usage
sar -u 1 5Collect CPU statistics
pidstat 1Show per-process resource usage
du -ah .sort -h | tail -20|Show the 20 largest items below current directory
find . -type fwc -l|Count files recursively
find . -type f -emptyFind empty files
find . -type d -emptyFind empty directories
ps aux --sort=-%memhead|Show top memory-consuming processes
ps aux --sort=-%cpuhead|Show top CPU-consuming processes
ss -tulpngrep LISTEN|Show listening sockets
journalctl -p err -bShow errors from current boot
ip -br aQuick network summary
df -hTShow disk usage and filesystem types
grep -Rni 'searchterm' .Recursive case-insensitive search with line numbers
find . -type f -mtime -1Find files modified in the last 24 hours
find . -type f -mtime +30Find files older than 30 days
tar -czf backup-$(date +%F).tar.gz /path/to/dataCreate a dated compressed backup
man commandOpen a manual page
command --helpShow command help
info commandOpen GNU Info documentation
apropos keywordSearch manual-page descriptions
whatis commandShow a one-line command description
tldr commandShow example-focused documentation if installed