Skip to content
browserutils

Bash Cheatsheet

Bash/shell commands quick reference

Bash Cheatsheet is a free online tool from BrowserUtils that bash/shell commands quick reference. It runs entirely in your browser — your data never leaves your device. No account required.

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

How to use Bash Cheatsheet

  1. 1 Paste or type your input into the editor above.
  2. 2 The tool processes your data instantly — right in your browser, with nothing sent to a server.
  3. 3 Copy the result with one click or continue editing your input.

About Bash Cheatsheet

Free online Bash cheatsheet. Quick reference for common Bash and shell commands including file operations, text processing, permissions, networking, and scripting. This tool runs entirely in your browser — your data is never sent to a server. Just paste your input, get instant results, and copy with one click. No sign-up or installation required.

Bash Cheatsheet specs

Runtime
100% client-side (browser)
Cost
Free — no account, no rate limits, no usage caps
Browser support
Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
Part of
299 developer tools on BrowserUtils (100% client-side)

Questions

What is the difference between Bash and shell?
A shell is any command-line interpreter. Bash (Bourne Again Shell) is a specific shell implementation and the default on most Linux distributions. Other shells include zsh, fish, and dash. Most basic commands work across all shells.
What are the most useful Bash keyboard shortcuts?
Ctrl+C cancels the current command, Ctrl+Z suspends it, Ctrl+R searches command history, Ctrl+A moves to the start of the line, Ctrl+E moves to the end, and Tab auto-completes file names and commands.
How do I redirect output to a file in Bash?
Use > to write output to a file (overwrites existing content) or >> to append. For example, ls > files.txt saves the directory listing. Use 2> to redirect errors and &> to redirect both stdout and stderr.
What is the difference between single and double quotes in Bash?
Double quotes allow variable expansion and command substitution ($VAR, $(cmd)). Single quotes treat everything literally with no expansion. Use single quotes when you want the exact string, and double quotes when you need variables interpolated.
Do these Bash commands work on macOS?
Most commands work on macOS since it ships with zsh (and previously Bash). Some GNU-specific flags differ from macOS BSD variants. Install GNU coreutils via Homebrew if you need full GNU compatibility.
Embed this tool

Copy this code to embed the tool on your website. Adjust the height to fit your layout.

<iframe src="https://www.browserutils.dev/embed/bash-cheatsheet" width="100%" height="500" frameborder="0" title="Bash Cheatsheet"></iframe>

Related tools

More Developer Reference

View all Developer Reference tools