A reference sheet for every command, operator, and concept covered in the Linux CLI series, organized by category and cross-referenced by chapter number.
Filesystem Navigation
Command
Purpose
Chapter
pwd
Print working directory
2
cd /path
Change directory
2
cd ..
Parent directory
2
cd ~
Home directory
2
cd -
Previous directory
2
ls
List directory contents
3
ls -l
Long format
3
ls -a
Include hidden files
3
ls -h
Human-readable sizes
3
ls -R
Recursive listing
3
file name
Identify file type
3
less file
Page through file
3
File Operations
Command
Purpose
Chapter
mkdir dir
Create directory
6
mkdir -p a/b/c
Create nested directories
6
cp src dst
Copy file
6
cp -r src dst
Copy recursively
6
mv src dst
Move or rename
6
rm file
Delete file
6
rm -r dir
Delete directory recursively
6
rm -f
Force delete
6
touch file
Create empty file / update timestamp
36
ln -s target link
Symbolic link
4
ln target link
Hard link
4
Wildcards
Pattern
Matches
Chapter
*
Any string
5
?
Single character
5
[abc]
One of a, b, c
5
[a-z]
Range
5
[!abc]
Not a, b, c
5
Help and Documentation
Command
Purpose
Chapter
type cmd
Show command type
7
which cmd
Locate executable
7
help builtin
Shell builtin help
8
cmd --help
Brief usage
8
man cmd
Manual page
8
whatis cmd
One-line description
9
apropos keyword
Search man pages
9
info cmd
GNU info page
9
Aliases and Shortcuts
Command
Purpose
Chapter
alias name='cmd'
Create alias
10
unalias name
Remove alias
10
Ctrl+C
Cancel current command
15
Ctrl+Z
Suspend current process
15
Ctrl+D
EOF / logout
15
Ctrl+L
Clear screen
15
Ctrl+A
Beginning of line
15
Ctrl+E
End of line
15
Ctrl+R
Reverse search history
15
!!
Last command
16
!n
Command number n
16
history
Command history
16
I/O Redirection and Pipes
Operator
Purpose
Chapter
>
Redirect stdout (overwrite)
11
>>
Redirect stdout (append)
11
<
Redirect stdin
11
2>
Redirect stderr
11
2>&1
stderr to stdout
11
|
Pipe stdout to stdin
12
tee file
Write to file and stdout
13
Text Processing
Command
Purpose
Chapter
cat file
Display file
12
grep pattern file
Search lines
12
grep -i
Case-insensitive
12
grep -r
Recursive
12
grep -v
Invert match
12
wc file
Count lines, words, bytes
12
uniq
Remove adjacent duplicates
13
sort file
Sort lines
42
sort -n
Numeric sort
42
sort -r
Reverse sort
42
head -n N
First N lines
13
tail -n N
Last N lines
13
tail -f
Follow file
13
echo text
Print text
14
echo -n
No trailing newline
14
echo -e
Interpret escapes
14
cut -d: -f1
Extract fields
43
paste file1 file2
Merge lines
43
join file1 file2
Join on common field
43
comm file1 file2
Compare sorted files
44
diff file1 file2
Show differences
44
patch file < diff
Apply patch
45
tr 'a-z' 'A-Z'
Translate characters
45
sed 's/old/new/g'
Stream edit
46
nl file
Number lines
48
fold -w N
Wrap lines
48
fmt -w N
Reformat paragraphs
48
pr file
Paginate
49
printf fmt args
Formatted output
49
Permissions and Ownership
Command
Purpose
Chapter
id
User and group IDs
18
chmod 755 file
Set permissions (octal)
18
chmod u+x file
Add execute (symbolic)
18
chmod -R
Recursive
18
umask
Default permission mask
18
su - user
Switch user
19
sudo cmd
Run as root
19
chgrp group file
Change group
20
chown user:group file
Change owner and group
20
passwd
Change password
20
Process Management
Command
Purpose
Chapter
ps aux
List all processes
21
ps -ef
List all processes (BSD)
21
top
Live process view
21
kill PID
Send SIGTERM
21
kill -9 PID
Send SIGKILL
21
killall name
Kill by name
21
pkill pattern
Kill by pattern
21
cmd &
Run in background
22
jobs
List background jobs
22
fg
Bring job to foreground
22
bg
Resume job in background
22
reboot
Restart system
22
shutdown -h now
Power off
22
Environment Variables
Command
Purpose
Chapter
printenv
Show environment
23
echo $VAR
Print variable
23
export VAR=val
Set and export
23
unset VAR
Remove variable
23
Editors and Prompt
Command
Purpose
Chapter
nano file
Open in nano
24
PS1='...'
Set primary prompt
25
PS2='...'
Set secondary prompt
25
Storage and Mounting
Command
Purpose
Chapter
mount /dev/sdb1 /mnt
Mount filesystem
27
umount /mnt
Unmount
27
mount
List mounts
27
fdisk -l
List partitions
28
fdisk /dev/sdb
Edit partition table
28
fsck /dev/sdb1
Check filesystem
29
mkfs.ext4 /dev/sdb1
Create filesystem
29
dd if=src of=dst bs=1M
Block copy
29
Networking
Command
Purpose
Chapter
ping host
Test reachability
30
traceroute host
Trace path
30
ip addr
Show addresses
31
ip route
Show routes
31
netstat -tuln
Listening ports
31
ftp host
FTP client
32
wget URL
Download file
32
ssh user@host
Remote shell
33
scp file user@host:/path
Secure copy
34
sftp user@host
Secure FTP
34
Search
Command
Purpose
Chapter
locate name
Fast file search (database)
35
updatedb
Update locate database
35
find /path -name '*.txt'
Search filesystem
35
find -type f
Only files
35
find -type d
Only directories
35
find -mtime -7
Modified in last 7 days
35
xargs cmd
Build command from stdin
36
File Metadata
Command
Purpose
Chapter
stat file
File metadata
37
stat -c '%i' file
Inode number
37
df -h
Disk usage
37
du -sh dir
Directory size
37
Compression and Archives
Command
Purpose
Chapter
gzip file
Compress to .gz
38
gunzip file.gz
Decompress
38
bzip2 file
Compress to .bz2
38
bunzip2 file.bz2
Decompress
38
tar -cvf arch.tar dir
Create tar
39
tar -xvf arch.tar
Extract tar
39
tar -czvf arch.tar.gz dir
Create gzip tar
39
tar -xzvf arch.tar.gz
Extract gzip tar
39
zip -r arch.zip dir
Create zip
39
unzip arch.zip
Extract zip
39
rsync -av src/ dst/
Synchronize
40
Regular Expressions
Pattern
Matches
Chapter
^
Start of line
41
$
End of line
41
.
Any character
41
*
Zero or more
41
+
One or more
41
?
Zero or one
41
[abc]
Character class
41
[^abc]
Negated class
41
|
Alternation
41
()
Grouping
41
\{n\}
Exactly n
41
Formatting and Printing
Command
Purpose
Chapter
aspell check file
Spell check
47
groff -ms file
Format document
50
pr file
Paginate
51
lpr file
Print file
51
lp file
Print file
51
lpstat -p
Printer status
52
lpq
Print queue
52
lprm job
Remove print job
52
Shell Scripting
Syntax
Purpose
Chapter
#!/bin/bash
Shebang
53
VAR=value
Assign variable
54
echo "$VAR"
Print variable
55
read VAR
Read input
56
read -p "prompt" VAR
Prompt for input
56
func() { ... }
Define function
57
local VAR
Local variable
58
if [ cond ]; then
Conditional
59
elif, else, fi
Condition branches
59
[ -f file ]
File exists
60
[ -d dir ]
Directory exists
60
[ -z "$s" ]
String empty
60
[ "$a" = "$b" ]
String equality
60
[ "$a" -eq "$b" ]
Numeric equality
60
(( a > b ))
Arithmetic test
61
while [ cond ]; do
While loop
62
until [ cond ]; do
Until loop
62
case "$x" in
Case statement
63
for i in list; do
For loop
64
for ((i=0; i<n; i++))
C-style for
64
${VAR:-default}
Default value
65
${VAR#prefix}
Strip prefix
65
${VAR%suffix}
Strip suffix
65
${#VAR}
String length
65
${VAR^^}
Uppercase
66
${VAR,,}
Lowercase
66
$((16#FF))
Hex to decimal
67
$((10#08))
Force decimal
67
$(( 2**10 ))
Exponent
68
echo "scale=2; 10/3" | bc
bc calculation
69
arr=(a b c)
Array definition
70
${arr[0]}
Array element
70
${arr[@]}
All elements
70
${#arr[@]}
Array length
70
Quick Decision Table
I want to…
Command
Find a file by name
find / -name 'x' 2>/dev/null
Find text in files
grep -r 'text' dir/
See disk usage
df -h
See directory size
du -sh dir/
Check open ports
ss -tuln
Kill a process by name
pkill -f name
Download a file
wget URL
Copy to remote
scp file user@host:/path
Archive a directory
tar -czvf a.tar.gz dir/
Extract a tarball
tar -xzvf a.tar.gz
Sync directories
rsync -av src/ dst/
Change permissions
chmod 755 file
Change owner
chown user:group file
Run as root
sudo cmd
Check logs
tail -f /var/log/syslog
Count lines
wc -l file
Sort and unique
sort file | uniq
Replace in file
sed -i 's/old/new/g' file
Extract columns
cut -d: -f1 file
Keywords
Was this helpful?
Stop using slow, ad-bloated tool sites! 🤮
🔎 Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for: ✅ Finance (Mortgage, Interest, Inflation) ✅ Tech (Base64, JSON, Dev Suite, IP) ✅ Health (BMI, BMR, TDEE) ✅ Productivity (Timer, Workspace, QR)
⚡️ Fast & Private 🔒 No data leaves your device 💎 100% Free