Shell Cheat Sheet
A searchable, printable Bash / shell reference — navigation, files, pipes, variables, loops, conditionals and handy one-liners. Free.
Navigation
8pwd
ls -la
cd /path
cd -
cd ~
tree -L 2
pushd / popd
ls -lhS
Files & directories
10touch file.txt
mkdir -p a/b/c
cp -r src dest
mv old new
rm -rf dir
ln -s target link
cat file.txt
head -n 20 / tail -n 20
tail -f log.txt
less file.txt
Search & find
8grep 'pattern' file
grep -rin 'text' .
find . -name '*.php'
find . -type f -mtime -1
find . -size +10M
which node
locate file.txt
grep -v 'skip' file
Text processing
9wc -l file
sort file | uniq -c
cut -d',' -f1 file
awk '{print $1}' file
sed 's/old/new/g' file
tr 'a-z' 'A-Z'
diff a.txt b.txt
tee out.txt
xargs -I{} cmd {}
Pipes & redirection
9a | b
cmd > file
cmd >> file
cmd 2> err.log
cmd > out 2>&1
cmd < input.txt
cmd1 && cmd2
cmd1 || cmd2
cmd &
Permissions & ownership
8chmod 755 file
chmod +x script.sh
chmod -R 644 dir
chown user:group file
umask 022
sudo cmd
stat file
ls -l file
Processes & system
9ps aux
top / htop
kill -9 PID
pkill -f name
jobs / fg / bg
df -h
du -sh dir
free -h
uname -a
Variables & expansion
9NAME='value'
echo \"$NAME\"
export PATH=\"$PATH:/x\"
$(command)
${VAR:-default}
$1 $2 $@
$?
read -p 'Name: ' x
echo {1..5}
Scripting
9#!/usr/bin/env bash
set -euo pipefail
if [ -f file ]; then ...; fi
[ \"$a\" = \"$b\" ]
for f in *.txt; do ...; done
while read line; do ...; done < file
case \"$x\" in a) ...;; esac
function greet() { echo hi; }
trap cleanup EXIT
No entry matches “:q”.
About Shell Cheat Sheet
This Bash and shell cheat sheet covers the command line from first steps to scripting: navigation, files and directories, search and find, text processing, pipes and redirection, permissions and ownership, processes and system info, variables and expansion, and shell scripting constructs.
It pairs everyday commands — ls, cp, grep, find, chmod, ps — with the flags that make them useful, plus the pipe, redirection and expansion syntax that turns single commands into one-liners. The scripting section reminds you of loop, conditional and function syntax when you write a script twice a year.
Everything is on one free, client-side page: search filters the rows live, the sticky table of contents jumps between sections, one click copies any command and the print button gives you a terminal reference for your desk.
How to use Shell Cheat Sheet
- Browse the sections, from Navigation and Files & directories through Pipes & redirection to Scripting.
- Type a command name like grep or chmod into the search box to filter the sheet instantly.
- Jump to a section such as Text processing via the sticky sidebar.
- Click a command or its copy icon to copy it, then paste it into your terminal.
- Print the page for an offline Bash command reference.