51 commands

ls
List Directory Contents
List files and directories in current or specified path
cd
Change Directory
Navigate to a different directory
pwd
Print Working Directory
Show the full path of the current directory
mkdir
Make Directory
Create new directories
cp
Copy Files & Directories
Copy files or directories from source to destination
mv
Move / Rename
Move or rename files and directories
!rm
Remove Files & Directories
Delete files or directories permanently
find
Find Files
Search for files by name, type, size, date, or permissions
ln
Create Links
Create hard or symbolic (soft) links to files
touch
Create / Update Timestamps
Create empty files or update modification timestamps
cat
Concatenate / Display Files
Display file contents or concatenate multiple files
head / tail
View File Start / End
Display the first or last lines of a file
grep
Search Text Patterns
Search for text patterns in files using regex
sed
Stream Editor
Find and replace text, delete lines, transform files
awk
Pattern Processing
Process structured text data column by column
sort
Sort Lines
Sort lines of text alphabetically, numerically, or by field
uniq
Filter Duplicates
Remove or count consecutive duplicate lines
wc
Word / Line Count
Count lines, words, and characters in files
cut
Extract Columns
Extract specific columns or character positions from text
tr
Translate Characters
Replace, delete, or squeeze characters
diff
Compare Files
Show differences between two files line by line
less
Page Through Files
View large files with scrolling (better than cat)
chmod
Change Permissions
Set read/write/execute permissions on files and directories
chown
Change Ownership
Change file owner and/or group
ps
List Processes
Show currently running processes
top / htop
Live Process Monitor
Real-time view of system processes and resource usage
!kill / killall
Terminate Processes
Send signals to processes (terminate, force-kill)
jobs / bg / fg
Job Control
Manage background and foreground processes
nohup
Run After Logout
Keep a process running after closing the terminal
uptime / uname
System Info
Show system uptime, load, and OS information
crontab
Schedule Tasks
Schedule commands to run at specified times
curl
HTTP Requests
Transfer data to/from URLs (GET, POST, download)
wget
Download Files
Download files from the web (supports resume)
ssh
Secure Shell
Connect to remote servers securely
scp
Secure Copy
Copy files between local and remote machines over SSH
rsync
Sync Files
Efficiently sync files (only transfers differences)
ping
Test Connectivity
Check if a host is reachable and measure latency
tar
Archive Files
Create or extract .tar, .tar.gz, .tar.bz2 archives
zip / unzip
Zip Archives
Create and extract .zip archives
gzip / gunzip
Gzip Compression
Compress or decompress single files with gzip
df
Disk Free Space
Show available disk space on mounted filesystems
du
Directory Size
Show disk usage of files and directories
| (pipe)
Pipe Output
Send output of one command as input to another
> >> < (redirect)
Redirect I/O
Redirect output to files or input from files
xargs
Build Commands from Input
Convert stdin lines into command arguments
tee
Split Output
Send output to both a file AND stdout (T-pipe)
export
Set Environment Variables
Set variables that child processes can access
alias
Create Shortcuts
Define shorthand commands for the shell
history
Command History
View and search previously executed commands
which / type
Locate Commands
Find where a command is installed or what it resolves to
source / .
Source Scripts
Execute a script in the current shell (not a subshell)

Frequently Asked Questions

What is the difference between > and >> in Bash?
> redirects output to a file and overwrites it if it exists. >> appends to the end of the file without overwriting. For example, echo "hello" > file.txt creates or overwrites, while echo "world" >> file.txt adds to the end.
How do I find large files on Linux?
Use find . -type f -size +100M to find files larger than 100 MB. Combine with du -sh * | sort -rh to see directory sizes. For the biggest files system-wide: find / -type f -size +100M 2>/dev/null | head -20.
What is the difference between kill and kill -9?
kill sends SIGTERM (signal 15) which asks the process to shut down gracefully, allowing it to clean up resources. kill -9 sends SIGKILL which forces immediate termination. The process cannot catch or ignore it. Always try kill first, use -9 only as a last resort.
How do I make a script executable?
Run chmod +x script.sh to add execute permission. Then you can run it with ./script.sh. You should also add a shebang line at the top: #!/bin/bash (or #!/usr/bin/env python3 for Python scripts).
What does 2>&1 mean in Bash?
2>&1 redirects stderr (file descriptor 2) to wherever stdout (file descriptor 1) is currently going. So command > file.txt 2>&1 sends both stdout and stderr to file.txt. The shorthand &> does the same thing in Bash.
How do pipes work in Linux?
The pipe operator | connects the stdout of the left command to the stdin of the right command. Data flows through like a pipeline: cat file | grep pattern | sort | uniq -c. Each command processes the data and passes it to the next.

About This Bash Reference

This interactive reference covers 51 essential Bash and Linux commands organized into 9 categories. Each command includes clean syntax, practical examples you can copy-paste, common flags, and visual diagrams explaining concepts like permissions, pipes, and redirection.

Commands are organized into categories: Files & Directories, Text Processing, Permissions & Ownership, Processes & System, Networking, Archives & Compression, Disk & Storage, Pipes & Redirection, and Environment & Shell. Destructive commands like rm -rf and kill -9 are clearly marked with warning indicators.