ls -laList all files with details
cd <dir>Change directory
pwdPrint working directory
mkdir -p <dir>Create directory (and parents)
rmdir <dir>Remove empty directory
rm <file>Remove file
rm -rf <dir>Remove directory recursively (force)
cp <src> <dest>Copy file
cp -r <src> <dest>Copy directory recursively
mv <src> <dest>Move or rename file/directory
touch <file>Create empty file or update timestamp
ln -s <target> <link>Create symbolic link
find . -name "*.txt"Find files by name pattern
find . -type f -mtime -7Find files modified in last 7 days
locate <file>Find files by name (uses index)
du -sh <dir>Show directory size (human-readable)
df -hShow disk space usage
treeDisplay directory tree
cat <file>Display file contents
less <file>View file with pagination
head -n 20 <file>Show first 20 lines
tail -n 20 <file>Show last 20 lines
tail -f <file>Follow file changes in real-time
grep "pattern" <file>Search for pattern in file
grep -r "pattern" <dir>Search recursively in directory
grep -i "pattern" <file>Case-insensitive search
grep -c "pattern" <file>Count matching lines
sed "s/old/new/g" <file>Replace text in file
awk '{print $1}' <file>Print first column
sort <file>Sort lines alphabetically
sort -n <file>Sort lines numerically
uniqRemove adjacent duplicate lines
wc -l <file>Count lines in file
wc -w <file>Count words in file
cut -d"," -f1 <file>Extract column from delimited file
tr "a-z" "A-Z"Translate/replace characters
diff <file1> <file2>Compare two files
chmod 755 <file>Set permissions (rwxr-xr-x)
chmod +x <file>Make file executable
chmod -R 644 <dir>Set permissions recursively
chown user:group <file>Change file owner and group
chown -R user <dir>Change owner recursively
umask 022Set default permissions mask
ps auxList all running processes
ps aux | grep <name>Find process by name
top / htopInteractive process viewer
kill <pid>Send SIGTERM to process
kill -9 <pid>Force kill process (SIGKILL)
killall <name>Kill all processes by name
bg / fgMove job to background / foreground
jobsList background jobs
nohup <cmd> &Run command immune to hangups
lsof -i :8080List processes on port 8080
curl <url>Transfer data from URL
curl -X POST -d "data" <url>Send POST request
wget <url>Download file from URL
ping <host>Test network connectivity
ssh user@hostConnect via SSH
scp file user@host:pathCopy file over SSH
rsync -avz src/ dest/Sync files (incremental)
netstat -tlnpList listening ports
ss -tlnpList listening ports (modern)
ifconfig / ip addrShow network interfaces
dig <domain>DNS lookup
nslookup <domain>Query DNS records
tar -czf archive.tar.gz <dir>Create gzip compressed archive
tar -xzf archive.tar.gzExtract gzip archive
tar -xjf archive.tar.bz2Extract bzip2 archive
zip -r archive.zip <dir>Create zip archive
unzip archive.zipExtract zip archive
gzip <file>Compress file with gzip
gunzip <file>.gzDecompress gzip file
cmd > fileRedirect stdout to file (overwrite)
cmd >> fileRedirect stdout to file (append)
cmd 2> fileRedirect stderr to file
cmd &> fileRedirect both stdout and stderr
cmd1 | cmd2Pipe output of cmd1 to cmd2
cmd < fileUse file as stdin
cmd | tee fileOutput to both stdout and file
cmd | xargs <cmd2>Pass output as arguments to cmd2
#!/bin/bashShebang line for bash scripts
VAR="value"Set variable (no spaces around =)
$VAR / ${VAR}Use variable value
$(command)Command substitution
if [ cond ]; then ... fiIf statement
for i in 1 2 3; do ... doneFor loop
while [ cond ]; do ... doneWhile loop
$1, $2, $@, $#Script arguments (1st, 2nd, all, count)
$?Exit status of last command
&&Run next command if previous succeeded
||Run next command if previous failed
alias name="command"Create command alias
browserutils
Bash Cheatsheet