Dev Tool

Linux Terminal Cheat Sheet

Essential Bash commands for file ops, navigation, search, processes, networking, and permissions

File Operations
File ls — list directory contents
ls # current directory
ls -la # all files with details
ls -lh # human-readable sizes
ls *.txt # pattern match
-a shows hidden files. -l long format. -h with -l for readable sizes.
File cp — copy files/directories
cp file.txt dest/ # copy file
cp -r dir/ dest/ # recursive copy directory
cp -i file.txt bak/ # prompt before overwrite
-r for directories. -v verbose. -i interactive (safe). -p preserve attributes.
File mv — move or rename
mv file.txt newname.txt # rename
mv file.txt /path/dir/ # move
mv -i *.txt backup/ # interactive bulk
Overwrites by default. Use -i (interactive) or -n (no-clobber) to prevent.
File rm — remove files/directories
rm file.txt # remove file
rm -r dir/ # remove directory recursively
rm -rf dir/ # force, no prompts (DANGEROUS)
rm -i *.log # prompt before each removal
rm -rf is irreversible. Triple-check path. Use trash-cli for safer deletion.

Directory Ops

mkdir — make directory
mkdir newdir
mkdir -p a/b/c # create nested
rmdir — remove empty dir
rmdir emptydir
rmdir -p a/b # remove parents if empty
File touch — create empty file or update timestamp
touch newfile.txt # create empty
touch file1 file2 file3 # multiple files
Also used to update file timestamps without modifying content. -t option sets explicit timestamp.

View File Contents

cat — concatenate/print file
cat file.txt
cat f1 f2 > combined.txt
less — scrollable viewer (preferred)
less longfile.log
j/k scroll, q quit, /search
more — basic paginator
more file.txt
space next, Enter line
Use less for large files. cat is best for small files or piping.
Navigation

Directory Navigation

pwd — print working dir
pwd
cd — change directory
cd /path/to/dir
cd .. # parent
cd ~ # home
cd - # previous dir
Search & Find
Search grep — search text in files
grep "pattern" file.txt
grep -r "TODO" . # recursive in current dir
grep -i "error" log.txt # case-insensitive
grep -n "fn" file.js # show line numbers
grep -v "debug" code.js # invert: exclude lines
-r recursive. -i case-insensitive. -n line numbers. -v invert match (exclude).
Search find — search for files/dirs
find . -name "*.txt" # by name pattern
find /var/log -type f # only files
find . -size +10M # larger than 10 MB
find . -mtime -7 # modified in last 7 days
find . -exec rm {} \; # execute on each result
-name (case-sensitive), -iname (case-insensitive). -exec runs command on matches. {} is placeholder.

Locate Binaries

which — path of executable
which node
which -a python # all matches
whereis — binary, source, man loc
whereis gcc
Process Management

View Processes

ps — snapshot of processes
ps aux # all processes
ps -ef | grep node # filter
top — live process viewer
top
q to quit, M sort by mem
htop — enhanced top
htop
(install: apt/brew)

Kill Processes

kill — send signal by PID
kill 1234 # SIGTERM
kill -9 1234 # SIGKILL (force)
pkill — by process name
pkill -f "node app.js"
killall — kill by exact name
killall chrome
kill -9 (SIGKILL) does not allow graceful shutdown. Try kill (SIGTERM) first.
Process jobs / bg / fg — background tasks
command & # start in background
jobs # list background jobs
fg %1 # bring job 1 to foreground
bg %1 # resume job in background
Use Ctrl+Z to suspend current foreground job, then bg or fg to resume.
Permissions
Perm chmod — change file permissions
chmod +x script.sh # add execute
chmod 755 app.js # rwxr-xr-x
chmod 644 config.json # rw-r--r--
chmod -R 755 dir/ # recursive
Numeric: read=4, write=2, exec=1. Sum per class (user/group/others).
755 = rwx (7) r-x (5) r-x (5)
644 = rw- (6) r-- (4) r-- (4)
Perm chown — change file owner/group
chown alice file.txt # change owner
chown alice:staff file.txt # owner and group
chown -R www-data:www-data /var/www # recursive
Requires sudo on most systems. Incorrect ownership can break services.
Networking

Download / HTTP

curl — transfer data (CLI browser)
curl -O https://url/file.zip
curl -I https://site.com # headers only
wget — download file
wget URL
wget -c file.zip # continue partial

Network Diagnostics

ping — test connectivity
ping google.com
ping -c 4 host # count=4
traceroute — path to host
traceroute google.com
nslookup — DNS lookup
nslookup example.com
Net ss / netstat — socket statistics
ss -tulpn # listening ports
netstat -tulpn # traditional (older)
ss is modern replacement for netstat on Linux. -t TCP, -u UDP, -l listening, -p process.
System Info

Disk Usage

df — disk free (filesystem)
df -h # human-readable
df -i # inode usage
du — disk usage (directory)
du -sh dir/ # summary human-readable
du -h --max-depth=1 # per-subdir

Memory / System

free — memory usage
free -h
uname — system info
uname -a # all details
uname -r # kernel version
Compression & Archives
File tar — tape archive (bundles files)
tar -cvf archive.tar dir/ # create tar
tar -xvf archive.tar # extract
tar -czvf archive.tar.gz dir/ # create gzipped
tar -xzvf archive.tar.gz # extract gzipped
tar -tjvf archive.tar # list contents
Flags: -c create, -x extract, -v verbose, -f file, -z gzip, -j bzip2.
Order doesn't matter: tar -zcvf = tar -czvf.

Compress Single Files

gzip — compress file
gzip file.txt
gunzip file.txt.gz
zip — zip archive
zip -r out.zip dir/
unzip — extract zip
unzip out.zip
gzip compresses files in-place (replaces original with .gz). Use tar for directories.
Text Processing

Basic Text

echo — print to stdout
echo "text"
echo $PATH # variable
head — first N lines
head file.txt
head -n 20 # 20 lines
tail — last N lines
tail -f logfile # follow live
tail -n 50 # last 50 lines
Text wc — word/line/byte count
wc file.txt # lines words bytes
wc -l file.txt # line count only
wc -w file.txt # word count
ls -1 | wc -l # count files in dir

Sort & Unique

sort — sort lines
sort file.txt
sort -r # reverse
sort -n # numeric
uniq — remove duplicates
uniq sorted.txt
sort file | uniq -c # count per value
uniq only removes adjacent duplicates. Pipe through sort first for full deduplication.

Stream Editors

sed — stream editor
sed 's/old/new/g' file.txt
sed -i 's/foo/bar/g' file # in-place
awk — pattern scanning
awk '{print $1}' file
awk -F: '{print $1}' /etc/passwd
sed 's/old/new/' replaces first occurrence. g flag = global (all). -i edits file in-place.

Detailed Guide: Mastering the Linux Terminal in 2026

As we navigate the highly automated and cloud-native world of 2026, the Linux terminal remains the definitive interface for power users, developers, and system administrators. While graphical user interfaces have their place, the speed, precision, and scriptability of the command line are unmatched for managing servers, automating deployments, and processing large datasets. Our Linux Terminal Cheat Sheet provides a categorized, searchable reference for the most essential Bash and shell commands, helping you work more efficiently and with greater confidence across any Unix-like environment.

A major focus in 2026 is the role of "Terminal Proficiency" in DevOps and security. Professional developers prioritize the use of standard, portable commands for file manipulation (ls, cp, mv), search (grep, find), and process management (ps, kill). Our cheat sheet includes the most common flags and practical examples for each, ensuring you have the right tool for every task. By mastering these core utilities, you can significantly reduce your reliance on third-party software and build more resilient, high-performance systems.

Finally, consider the importance of "Local-First" privacy in your system administration workflows. At AllOmnitools, we believe your terminal habits and infrastructure details should remain private. Our Linux Cheat Sheet runs entirely in your browser, ensuring that your search queries and the commands you browse never leave your device. This approach provides zero-latency access to critical information, even in restricted or offline environments. By combining this cheat sheet with other AllOmnitools like the Crontab Descriptor, you have a complete ecosystem for mastering the digital infrastructure of 2026.

Why Choose AllOmnitools?

Instant Results

Zero server lag. All Linux commands and categories are searchable instantly for your workflow.

100% Private

Your search queries and terminal preferences remain private. We never track or store your system data.

Frequently Asked Questions

What is the difference between Bash and Shell?

Shell is a general category of command-line interpreters. Bash (Bourne Again SHell) is a specific, widely used implementation that is the default on many Linux distributions and macOS.

How do I see hidden files in Linux?

Use the ls -a command. Files and directories starting with a dot (e.g., .bashrc) are considered hidden by default in Unix-like systems.

What does chmod 755 mean?

It sets permissions so the owner can read, write, and execute (7), while the group and others can only read and execute (5). It's a common setting for public scripts and directories.

Is my data safe when using this cheat sheet?

Yes. AllOmnitools is "local-first." We provide the information and command examples locally in your browser. You never need to submit your proprietary system details to our servers.

How do I find a file by name in the terminal?

The find . -name "filename.txt" command is the standard way to search for files recursively from your current directory.

Can I use these commands on macOS?

Yes! Most commands in our cheat sheet are part of the POSIX standard and work perfectly on macOS, although some flags may differ slightly from the Linux versions.

Related Tools