Bash Commands Cheatsheet — Linux Terminal Reference

Essential Bash/Linux commands: file ops, text processing, permissions, processes, networking. Daily driver reference.

File Operations

CommandDescription
ls -laList all files with details
cd /pathChange directory
mkdir -p dir/subdirCreate nested directories
cp -r src destCopy recursively
mv old newMove/rename
rm -rf dirRemove recursively (careful!)
find . -name "*.js"Find files by name
du -sh *Directory sizes
df -hDisk space usage

Text Processing

CommandDescription
cat filePrint file contents
head -20 fileFirst 20 lines
tail -f logFollow log file
grep -r "pattern" .Search recursively
sed 's/old/new/g' fileFind and replace
awk '{print $1}' filePrint first column
sort file | uniq -cCount unique lines
wc -l fileCount lines

Process Management

CommandDescription
ps auxList all processes
top / htopInteractive process viewer
kill <pid>Send SIGTERM
kill -9 <pid>Force kill
nohup cmd &Run in background (survives logout)
jobs / fg / bgJob control

Networking

CommandDescription
curl -s urlHTTP request
wget urlDownload file
ss -tulpnShow listening ports
ping hostCheck connectivity
dig domainDNS lookup

Pipes & Redirection

# Pipe output to another command
cat file | grep "error" | wc -l

# Redirect stdout to file
command > output.txt

# Append to file
command >> output.txt

# Redirect stderr
command 2> errors.txt

# Redirect both
command > output.txt 2>&1

Need These Tools as an API?

TextForge API offers 20+ developer toolkit endpoints. Free tier: 50 requests/day.

Try TextForge API Free →

Related Tools