Reference

Linux Command Index

Fast reference for setup and troubleshooting work. Search by command name, what it does, the problem being solved, or words like logs, port, disk, permissions, service, or dns. Each card explains when to use it, why it matters, common arguments, and copy-pasteable examples.

Commands113
Categories11
Quick Tasks16
SearchLive
Quick troubleshooting moves

What is using a port?

Find which process is listening on or connected to a port.

ss -tulpn | grep :80 lsof -i :80
Use this when Apache, nginx, Node, PHP-FPM, or another service says a port is already in use.

Why will a service not start?

Check status first, then read its recent logs.

systemctl status apache2 journalctl -u apache2 -n 100 --no-pager
This is usually the fastest path to the real error.

What changed recently?

Look for files modified in the last day or hour.

find . -type f -mtime -1 find /etc -type f -mmin -60
Useful after config edits, deployments, or mysterious breakages.

Why is disk space gone?

Check filesystem usage, then drill into big directories.

df -h du -sh /* 2>/dev/null | sort -h
Use this when writes fail, logs stop growing, or apps throw no-space errors.

What is hammering CPU or RAM?

Inspect live resource usage by process.

top htop ps aux --sort=-%mem | head
Good first step when a system feels slow or unstable.

What do the newest logs say?

Read the end of a log and optionally follow it live.

tail -50 /var/log/syslog tail -f /path/to/app.log
Best for real-time troubleshooting while reproducing a problem.

Is DNS the problem?

Query DNS records directly.

dig example.com A +short dig rawkiln.com MX
Use this when a domain does not resolve, mail fails, or DNS propagation seems wrong.

Can this host or port be reached?

Test reachability at host or port level.

ping 8.8.8.8 nc -vz host 22 curl -I https://example.com
Good for separating network path issues from app issues.

Who am I and what groups do I have?

Confirm identity, groups, and current shell context.

whoami id pwd
Prevents permission mistakes and 'why did this write there?' confusion.

What hardware does Linux see?

Check kernel and hardware-level visibility.

dmesg -T | tail lsusb lspci lsblk -f
Useful for USB devices, disks, adapters, and driver problems.

How do I keep a long job running after disconnect?

Run it in a persistent session or detached mode.

tmux new -s work screen -S work nohup command > out.log 2>&1 &
Stops work from dying when SSH drops.

How do I safely change or test a file first?

Copy a backup, inspect metadata, then edit.

cp config.php config.php.bak stat config.php less config.php
Small habit, big reduction in avoidable mistakes.

Does Linux even see the HaLow radio?

Check whether the interface, phy, and capabilities exist at all.

iw dev iw phy iw list rfkill list
Use this first when the radio seems invisible, blocked, or not fully initialized.

Is the Pi overlay / SPI bring-up correct?

Confirm boot overlay lines and look for SPI device nodes.

grep -n 'dtoverlay' /boot/config.txt /boot/firmware/config.txt 2>/dev/null ls /boot/overlays ls /dev/spidev* ls /sys/bus/spi/devices
A bad or missing overlay can make the whole stack fail before the driver even matters.

Did the driver and support modules load?

Check module presence and read module metadata.

lsmod | grep -E 'nrc|mac80211|cfg80211' modinfo nrc modinfo mac80211 modinfo cfg80211
This is the fast path for catching wrong module versions, missing firmware expectations, or unloaded dependencies.

Why is the link up but traffic still broken?

Check route choice, neighbor resolution, and packet presence.

ip -br a ip route ip route get 192.168.1.20 ip neigh sudo tcpdump -i wlan0 -nn host 192.168.1.20
Use this when association looks OK but peer traffic still does not work.
Matches 113
Browse by category or search across the full index
No commands match that filter yet. Try a broader word like logs, network, disk, service, user, or file.
Archives & Remote10 commands
tar
Archives & Remote
Syntax
tar [options] archive files
When to use it

Use it for packaging backups, logs, or source trees.

Why it matters

It is the standard archive tool on Linux.

Examples
tar -czf backup.tar.gz app/ tar -xzf backup.tar.gz tar -tf backup.tar.gz
Common arguments
  • -c = create
  • -x = extract
  • -z = gzip
  • -f = archive file
  • -t = list contents
gzip
Archives & Remote
Syntax
gzip [file]
When to use it

Use it to shrink text logs, dumps, or archives.

Why it matters

It is simple and widely supported.

Examples
gzip access.log gunzip access.log.gz
Common arguments
  • -k = keep original on some systems
  • -d = decompress
zip
Archives & Remote
Syntax
zip [options] archive files
When to use it

Use it when sharing files with systems or users that expect zip format.

Why it matters

Zip is widely compatible, especially across platforms.

Examples
zip -r site.zip public/
Common arguments
  • -r = recursive
unzip
Archives & Remote
Syntax
unzip [archive]
When to use it

Use it to unpack downloaded software or shared bundles.

Why it matters

Essential for handling zip packages.

Examples
unzip site.zip unzip file.zip -d /tmp/out
Common arguments
  • -d DIR = extract into directory
  • -l = list contents
rsync
Archives & Remote
Syntax
rsync [options] source destination
When to use it

Use it for backups, deployments, mirrors, and incremental copies.

Why it matters

It only transfers changed data and preserves metadata well.

Examples
rsync -av src/ dst/ rsync -avz ./ user@host:/var/www/ rsync -uv file1 file2
Common arguments
  • -a = archive mode
  • -v = verbose
  • -z = compress transfer
  • -u = skip newer destination files
  • --delete = remove files not in source
scp
Archives & Remote
Syntax
scp [options] source destination
When to use it

Use it when you need a quick secure copy to or from another host.

Why it matters

It is simple for one-off remote transfers.

Examples
scp file.txt user@host:/tmp/ scp user@host:/var/log/syslog .
Common arguments
  • -r = recursive
  • -P PORT = SSH port
sftp
Archives & Remote
Syntax
sftp user@host
When to use it

Use it when you want a session for browsing and transferring remote files securely.

Why it matters

Useful when you need multiple remote file operations in one session.

Examples
sftp user@host
Common arguments
  • put = upload
  • get = download
  • ls/cd = remote navigation
ssh
Archives & Remote
Syntax
ssh [options] user@host
When to use it

Use it for remote administration, commands, tunneling, and copying.

Why it matters

It is the core remote admin tool on Linux.

Examples
ssh user@server ssh -p 2222 user@host ssh user@host 'uptime'
Common arguments
  • -p PORT = SSH port
  • -i KEY = identity file
  • -L = local port forward
ssh-keygen
Archives & Remote
Syntax
ssh-keygen [options]
When to use it

Use it when setting up passwordless login or deploy access.

Why it matters

SSH keys are more secure and more convenient than passwords.

Examples
ssh-keygen -t ed25519 -C 'workstation key'
Common arguments
  • -t TYPE = key type
  • -C COMMENT = label
screen
Archives & Remote
Syntax
screen [options]
When to use it

Use it for long-running jobs over SSH that must survive disconnects.

Why it matters

Prevents work from dying when your connection drops.

Examples
screen -S backupjob screen -ls
Common arguments
  • -S NAME = session name
  • -ls = list sessions
  • Ctrl+A D = detach
Diagnostics & Hardware10 commands
lsof
Diagnostics & Hardware
Syntax
lsof [options]
When to use it

Use it to find which process is using a file, directory, or network port.

Why it matters

It is one of the best commands for 'what is holding this open?' problems.

Examples
lsof /var/log/syslog lsof -i :80 lsof -u www-data
Common arguments
  • -i :PORT = open network port
  • -u USER = files open by user
strace
Diagnostics & Hardware
Syntax
strace [options] command
When to use it

Use it when a command fails mysteriously, hangs, or gets permission/file errors.

Why it matters

It shows what the program is trying to do at the OS level.

Examples
strace -o trace.txt php script.php strace -p 1234
Common arguments
  • -o FILE = write trace to file
  • -p PID = attach to process
lspci
Diagnostics & Hardware
Syntax
lspci [options]
When to use it

Use it when checking detected hardware like NICs, GPUs, or storage controllers.

Why it matters

Good first step for hardware identification.

Examples
lspci lspci -nn
Common arguments
  • -nn = show numeric vendor and device IDs
lsusb
Diagnostics & Hardware
Syntax
lsusb
When to use it

Use it when checking whether USB hardware is detected.

Why it matters

Useful for adapters, dev boards, radios, storage, and keyboards.

Examples
lsusb
Common arguments
  • -t = tree view on some systems
sensors
Diagnostics & Hardware
Syntax
sensors
When to use it

Use it when checking overheating or fan-related issues.

Why it matters

It helps explain throttling and unexpected shutdowns.

Examples
sensors
Common arguments
  • no common flags needed for routine use
smartctl
Diagnostics & Hardware
Syntax
smartctl [options] device
When to use it

Use it when disks act strangely, throw errors, or you suspect failing hardware.

Why it matters

It gives direct health info from the drive.

Examples
sudo smartctl -a /dev/sda sudo smartctl -H /dev/nvme0n1
Common arguments
  • -a = all SMART info
  • -H = health summary
iostat
Diagnostics & Hardware
Syntax
iostat [options] [interval] [count]
When to use it

Use it when a system feels slow and you suspect disk bottlenecks.

Why it matters

It helps separate CPU problems from storage problems.

Examples
iostat -xz 1 5
Common arguments
  • -x = extended stats
  • -z = omit idle devices
sar
Diagnostics & Hardware
Syntax
sar [options]
When to use it

Use it when you need to answer what happened earlier, not just right now.

Why it matters

It is valuable for retrospective performance analysis.

Examples
sar -u 1 5 sar -r sar -n DEV
Common arguments
  • -u = CPU
  • -r = memory
  • -n DEV = network stats
nproc
Diagnostics & Hardware
Syntax
nproc
When to use it

Use it when tuning build jobs or checking CPU core availability.

Why it matters

Handy for parallelism settings like make -j.

Examples
nproc
Common arguments
  • --all = total installed processors
yes
Diagnostics & Hardware
Syntax
yes [string]
When to use it

Use it to auto-answer simple prompts or generate endless output for testing.

Why it matters

Small but surprisingly handy in scripts and pipelines.

Examples
yes | head yes y | rm -i *.tmp
Common arguments
  • string = repeated text
HaLow / Wireless13 commands
iw
HaLow / Wireless
Syntax
iw [object] [command]
When to use it

Use it anytime you need to see whether the radio exists, what capabilities it has, whether it is linked, or what peers and surveys look like.

Why it matters

For modern Linux wireless work, this is one of the main tools and is much more useful than legacy wireless tools.

Examples
iw dev iw phy iw list iw dev wlan0 link iw dev wlan0 station dump iw dev wlan0 scan | less iw dev wlan0 survey dump
Common arguments
  • dev = work with interfaces like wlan0
  • phy = work with the physical radio
  • list = show capabilities
  • scan = trigger or print scan results
  • station dump = show connected peer details
  • survey dump = show channel usage/noise data
rfkill
HaLow / Wireless
Syntax
rfkill [command]
When to use it

Use it when the radio seems missing or will not transmit and you suspect a kill switch or soft block.

Why it matters

It quickly tells you whether Linux itself is blocking the wireless device.

Examples
rfkill list rfkill unblock wifi
Common arguments
  • list = show current block state
  • unblock wifi = clear a software block for wireless devices
iwconfig
HaLow / Wireless
Syntax
iwconfig [interface]
When to use it

Use it only when checking older scripts or legacy driver setups that still reference wireless extensions.

Why it matters

It still appears in a lot of older how-tos, so it is useful to recognize, but for modern work iw is usually the better tool.

Examples
iwconfig iwconfig wlan0
Common arguments
  • interface = show status for a specific wireless interface
ip neigh
HaLow / Wireless
Syntax
ip neigh [show]
When to use it

Use it when association looks fine but peers still cannot actually exchange traffic.

Why it matters

It helps separate a layer-2 neighbor problem from a higher-level routing or application problem.

Examples
ip neigh ip neigh show dev wlan0
Common arguments
  • show = display neighbor entries
  • dev IFACE = limit to one interface
tracepath
HaLow / Wireless
Syntax
tracepath [host]
When to use it

Use it when packets leave but do not arrive cleanly, or when you suspect a path or MTU problem.

Why it matters

It is a fast next step after ping when basic reachability exists but something still breaks.

Examples
tracepath 192.168.1.20 tracepath example.com
Common arguments
  • -n = numeric output
modinfo
HaLow / Wireless
Syntax
modinfo [module]
When to use it

Use it when you need to confirm what module you have, where it lives, which version it is, or what firmware and parameters it expects.

Why it matters

This is one of the quickest ways to validate driver/module assumptions during bring-up.

Examples
modinfo nrc modinfo mac80211 modinfo cfg80211
Common arguments
  • -p = show module parameters
  • -F field = show one field such as filename or firmware
lsmod
HaLow / Wireless
Syntax
lsmod
When to use it

Use it when you need to see whether the expected wireless, SPI, or supporting modules actually loaded.

Why it matters

It is the fastest loaded-module sanity check before going deeper.

Examples
lsmod | grep -E 'nrc|mac80211|cfg80211' lsmod | less
Common arguments
  • Use with grep to narrow to a module family
journalctl
HaLow / Wireless
Syntax
journalctl [options]
When to use it

Use it for boot-time driver logs, supplicant failures, network service issues, and reproducing problems while watching live output.

Why it matters

For systemd-based systems it is one of the fastest routes to the real error.

Examples
journalctl -b journalctl -k -b journalctl -u wpa_supplicant -b journalctl -u systemd-networkd -b journalctl -u NetworkManager -b
Common arguments
  • -b = current boot
  • -k = kernel messages only
  • -u UNIT = one service
  • -f = follow live
mount
HaLow / Wireless
Syntax
mount [options] source target
When to use it

Use it when a guide tells you to mount debugfs before inspecting ieee80211 or other kernel debug paths.

Why it matters

Some low-level debug views do not exist until the right pseudo-filesystem is mounted.

Examples
sudo mount -t debugfs none /sys/kernel/debug mount | grep debugfs
Common arguments
  • -t TYPE = filesystem type such as debugfs
trace-cmd
HaLow / Wireless
Syntax
trace-cmd [record|report] [options]
When to use it

Use it when a wireless failure is too subtle for normal logs and you need kernel event tracing while reproducing the issue.

Why it matters

It gives much deeper visibility into wireless stack behavior than normal user-space logs.

Examples
trace-cmd record -e mac80211 -e cfg80211 trace-cmd report -i trace.dat | less
Common arguments
  • record = capture events into a trace file
  • -e EVENT = select event groups
  • report = print a recorded trace
tcpdump
HaLow / Wireless
Syntax
tcpdump [options]
When to use it

Use it when the link appears up but traffic is failing and you need to see whether packets are actually present on the wire.

Why it matters

It quickly separates RF/link problems from IP, routing, and application problems.

Examples
sudo tcpdump -i wlan0 -nn -s0 -w halow_capture.pcap sudo tcpdump -i wlan0 -nn host 192.168.1.20
Common arguments
  • -i IFACE = capture on an interface
  • -nn = do not resolve names
  • -s0 = full packet capture
  • -w FILE = write a pcap file
grep dtoverlay
HaLow / Wireless
Syntax
grep -n 'dtoverlay' /boot/config.txt /boot/firmware/config.txt
When to use it

Use it when you need to confirm that the expected SPI or HaLow overlay is actually referenced in Pi boot config.

Why it matters

A missing or wrong overlay line can make the hardware look completely absent higher up the stack.

Examples
grep -n 'dtoverlay' /boot/config.txt /boot/firmware/config.txt 2>/dev/null
Common arguments
  • -n = show matching line numbers
  • 2>/dev/null = hide missing-file noise when only one path exists
ls /dev/spidev*
HaLow / Wireless
Syntax
ls /dev/spidev*
When to use it

Use it when verifying that Pi SPI bring-up succeeded far enough to expose spidev devices.

Why it matters

It is an immediate sanity check before blaming higher-level driver code.

Examples
ls /dev/spidev* ls -l /dev/spidev*
Common arguments
  • -l = show ownership and permissions
Navigation & Files10 commands
pwd
Navigation & Files
Syntax
pwd
When to use it

Use it when you are not sure where you are in the filesystem before editing, deleting, or copying files.

Why it matters

Prevents mistakes caused by running commands in the wrong directory.

Examples
pwd
Common arguments
  • -P = show the physical path without symlinks
  • -L = show the logical path (default in many shells)
ls
Navigation & Files
Syntax
ls [options] [path]
When to use it

Use it to inspect what exists in a directory before opening, moving, or deleting anything.

Why it matters

It is the fastest way to see names, permissions, sizes, and timestamps.

Examples
ls -lah ls -lt /var/log ls -R /etc/apache2
Common arguments
  • -l = long listing
  • -a = include hidden files
  • -h = human-readable sizes
  • -t = sort by time
  • -R = recursive
cd
Navigation & Files
Syntax
cd [path]
When to use it

Use it anytime you need to move to a different folder to run commands there.

Why it matters

Many Linux commands operate relative to the current directory.

Examples
cd /var/log cd .. cd ~ cd -
Common arguments
  • .. = parent directory
  • ~ = home directory
  • - = previous directory
tree
Navigation & Files
Syntax
tree [options] [path]
When to use it

Use it to quickly understand project layouts, log folders, or config directories.

Why it matters

It is much easier to visualize nested folders than with repeated ls calls.

Examples
tree . tree -L 2 /etc/apache2 tree -a ~/public_html
Common arguments
  • -L N = limit depth
  • -a = include hidden files
  • -d = show directories only
find
Navigation & Files
Syntax
find [path] [tests] [actions]
When to use it

Use it when you know part of a name, need files changed recently, or need to bulk-process matches.

Why it matters

It is one of the most powerful ways to locate files on Linux.

Examples
find . -name '*.php' find /var/log -type f -mtime -1 find . -type d -name cache
Common arguments
  • -name = match by name
  • -type f|d = file or directory
  • -mtime = modified days ago
  • -size = size match
  • -exec ... {} \; = run command on matches
locate
Navigation & Files
Syntax
locate [pattern]
When to use it

Use it when you want a very fast filename search and do not need real-time freshness.

Why it matters

It is much faster than find for broad filename lookups.

Examples
locate php.ini locate '*.service'
Common arguments
  • -i = case-insensitive
  • -n N = limit results
stat
Navigation & Files
Syntax
stat [file]
When to use it

Use it to inspect exact timestamps, permissions, inode numbers, or file size during troubleshooting.

Why it matters

It gives more precise details than ls.

Examples
stat style.css stat /var/log/syslog
Common arguments
  • -c FORMAT = custom output format
  • -f = show filesystem status
file
Navigation & Files
Syntax
file [file]
When to use it

Use it when an extension is misleading or you are unsure what a file really is.

Why it matters

It helps confirm whether something is text, binary, image, archive, script, or executable.

Examples
file backup.tar.gz file /bin/bash
Common arguments
  • -i = show MIME type
cp
Navigation & Files
Syntax
cp [options] source destination
When to use it

Use it to duplicate files, stage backups, or clone directory trees.

Why it matters

It is the standard safe way to copy data before making changes.

Examples
cp config.php config.php.bak cp -a app/ app.bak/ cp -r dir1 dir2
Common arguments
  • -r = recursive
  • -a = archive mode (preserve metadata)
  • -v = verbose
  • -i = prompt before overwrite
mv
Navigation & Files
Syntax
mv [options] source destination
When to use it

Use it when reorganizing files or changing names without copying.

Why it matters

It is usually faster than copy+delete and is the standard rename tool.

Examples
mv old.php new.php mv logs/ archive/ mv *.log oldlogs/
Common arguments
  • -i = prompt before overwrite
  • -n = never overwrite
  • -v = verbose
Networking10 commands
ip
Networking
Syntax
ip [object] [command]
When to use it

Use it for almost all modern networking checks instead of older ifconfig/route tools.

Why it matters

It is the current standard network management command.

Examples
ip a ip r ip link show
Common arguments
  • a|addr = addresses
  • r|route = routes
  • link = interfaces
ss
Networking
Syntax
ss [options]
When to use it

Use it to see what is bound to a port or which connections are open.

Why it matters

It is faster and more modern than netstat.

Examples
ss -tulpn ss -tn state established
Common arguments
  • -t = TCP
  • -u = UDP
  • -l = listening
  • -p = process
  • -n = numeric
ping
Networking
Syntax
ping [options] host
When to use it

Use it as a first check for network path and basic DNS resolution.

Why it matters

It quickly tells you whether a host responds at all.

Examples
ping 8.8.8.8 ping google.com
Common arguments
  • -c N = send N packets
  • -4|-6 = IPv4 or IPv6
traceroute
Networking
Syntax
traceroute host
When to use it

Use it when a remote host is reachable poorly or traffic seems to die somewhere in between.

Why it matters

It helps isolate where along the route the problem appears.

Examples
traceroute google.com
Common arguments
  • -n = numeric output
  • -I = ICMP mode on some systems
tracepath
Networking
Syntax
tracepath host
When to use it

Use it when traceroute is unavailable or you want a quick path check.

Why it matters

Useful lightweight alternative.

Examples
tracepath google.com
Common arguments
  • no common flags needed for routine use
curl
Networking
Syntax
curl [options] URL
When to use it

Use it for API calls, downloads, header checks, testing web services, and debugging redirects.

Why it matters

It is one of the most important network troubleshooting tools.

Examples
curl -I https://example.com curl -L -o file.zip https://example.com/file.zip curl -H 'Accept: application/json' https://api.example.com
Common arguments
  • -I = fetch headers only
  • -L = follow redirects
  • -o FILE = save to file
  • -H = custom header
  • -v = verbose
wget
Networking
Syntax
wget [options] URL
When to use it

Use it for simple file grabs, recursive downloads, or resuming transfers.

Why it matters

It is straightforward and script-friendly.

Examples
wget https://example.com/file.tar.gz wget -c https://example.com/big.iso
Common arguments
  • -O FILE = save as name
  • -c = continue/resume
  • -q = quiet
dig
Networking
Syntax
dig [name] [type]
When to use it

Use it when troubleshooting domain resolution, MX records, nameservers, or propagation.

Why it matters

It shows authoritative DNS answers clearly.

Examples
dig example.com A dig rawkiln.com MX dig @8.8.8.8 example.com
Common arguments
  • A/AAAA/MX/TXT/NS = record types
  • @SERVER = query a specific DNS server
  • +short = compact output
nslookup
Networking
Syntax
nslookup [name] [server]
When to use it

Use it for quick hostname-to-IP checks or when dig is not installed.

Why it matters

It is widely available and easy to remember.

Examples
nslookup example.com nslookup rawkiln.com 8.8.8.8
Common arguments
  • server = specify DNS server
nc
Networking
Syntax
nc [options] host port
When to use it

Use it to test whether a port is reachable or to create simple listeners.

Why it matters

Excellent for quick low-level network checks.

Examples
nc -vz localhost 80 nc -l 9000
Common arguments
  • -v = verbose
  • -z = scan without sending data
  • -l = listen
Packages, Jobs & Scheduling10 commands
tmux
Packages, Jobs & Scheduling
Syntax
tmux [command]
When to use it

Use it for long jobs, multiple shells, or remote work that must survive disconnects.

Why it matters

It is extremely useful for serious terminal workflows.

Examples
tmux tmux new -s work tmux ls
Common arguments
  • new -s NAME = new named session
  • ls = list sessions
  • attach -t NAME = reattach
apt
Packages, Jobs & Scheduling
Syntax
apt [command] [package]
When to use it

Use it to install, remove, search, and update software packages.

Why it matters

It is the standard way to manage software on Debian systems.

Examples
sudo apt update sudo apt install nginx apt search php8.4
Common arguments
  • update = refresh package indexes
  • install = install package
  • remove = uninstall package
  • search = search packages
dpkg
Packages, Jobs & Scheduling
Syntax
dpkg [options] [package]
When to use it

Use it to inspect installed .deb packages or install a local .deb file.

Why it matters

Helpful when apt is not enough or when checking package contents.

Examples
dpkg -l | grep php sudo dpkg -i package.deb
Common arguments
  • -l = list packages
  • -i = install .deb
  • -L = list files from installed package
crontab
Packages, Jobs & Scheduling
Syntax
crontab [options]
When to use it

Use it when scheduling recurring scripts or maintenance tasks.

Why it matters

Cron is one of the core Linux automation tools.

Examples
crontab -e crontab -l
Common arguments
  • -e = edit cron jobs
  • -l = list cron jobs
  • -r = remove cron jobs
at
Packages, Jobs & Scheduling
Syntax
at TIME
When to use it

Use it when you need a delayed one-off action instead of a recurring cron job.

Why it matters

It is simpler than creating temporary cron entries.

Examples
echo 'systemctl restart apache2' | at 02:00
Common arguments
  • TIME = natural-ish time expression depending on system
watch
Packages, Jobs & Scheduling
Syntax
watch [options] command
When to use it

Use it to monitor disk, memory, process, or service state every few seconds.

Why it matters

It turns static commands into lightweight dashboards.

Examples
watch -n 2 df -h watch 'ss -tulpn | grep :80'
Common arguments
  • -n SEC = refresh interval
nohup
Packages, Jobs & Scheduling
Syntax
nohup command &
When to use it

Use it when starting a background job that should survive terminal logout.

Why it matters

Useful for one-off detached jobs when you do not need tmux/screen.

Examples
nohup php script.php > script.log 2>&1 &
Common arguments
  • & = background the process
jobs
Packages, Jobs & Scheduling
Syntax
jobs
When to use it

Use it when managing jobs started from your current shell.

Why it matters

Helps you see what is suspended or running in the background.

Examples
jobs
Common arguments
  • -l = include PIDs
bg
Packages, Jobs & Scheduling
Syntax
bg [%job]
When to use it

Use it after pressing Ctrl+Z on a command you want to keep running.

Why it matters

Lets you recover a stopped task without starting over.

Examples
bg bg %1
Common arguments
  • %1 = specific job number
fg
Packages, Jobs & Scheduling
Syntax
fg [%job]
When to use it

Use it when you need to interact with a job again.

Why it matters

It returns control of a shell job to the terminal.

Examples
fg fg %1
Common arguments
  • %1 = specific job number
Permissions & Storage10 commands
chmod
Permissions & Storage
Syntax
chmod [options] mode file
When to use it

Use it when access is denied or you need to adjust read/write/execute bits.

Why it matters

Permissions are a common cause of Linux issues.

Examples
chmod 644 file.txt chmod +x script.sh chmod -R 755 public
Common arguments
  • 755/644 = numeric modes
  • u+x = symbolic mode
  • -R = recursive
chown
Permissions & Storage
Syntax
chown [options] owner[:group] file
When to use it

Use it when files belong to the wrong user or service account.

Why it matters

Wrong ownership often breaks websites, logs, and uploads.

Examples
chown www-data:www-data index.php chown -R jaysoncraig:www-data public_html
Common arguments
  • -R = recursive
umask
Permissions & Storage
Syntax
umask [mode]
When to use it

Use it when newly created files keep getting the wrong default permissions.

Why it matters

It explains why new files are more or less open than expected.

Examples
umask umask 022
Common arguments
  • 022 = common default for readable files
df
Permissions & Storage
Syntax
df [options] [path]
When to use it

Use it when storage is low or writes start failing.

Why it matters

It quickly tells you whether a filesystem is full.

Examples
df -h df -i df -h /var
Common arguments
  • -h = human-readable
  • -i = inode usage
du
Permissions & Storage
Syntax
du [options] [path]
When to use it

Use it after df shows a full disk and you need to find what is consuming space.

Why it matters

It helps locate the big directories quickly.

Examples
du -sh * du -sh /var/log du -xh / | sort -h | tail
Common arguments
  • -s = summary only
  • -h = human-readable
  • -x = stay on one filesystem
mount
Permissions & Storage
Syntax
mount [options] [device dir]
When to use it

Use it when working with extra disks, USB drives, ISO files, or troubleshooting mounts.

Why it matters

Many storage issues come down to what is or is not mounted.

Examples
mount mount /dev/sdb1 /mnt/data
Common arguments
  • -o OPTIONS = mount options
  • -t TYPE = filesystem type
umount
Permissions & Storage
Syntax
umount [target]
When to use it

Use it before removing media or remounting with new options.

Why it matters

Prevents corruption and releases the filesystem cleanly.

Examples
umount /mnt/data umount /dev/sdb1
Common arguments
  • -l = lazy unmount in stuck cases
lsblk
Permissions & Storage
Syntax
lsblk [options]
When to use it

Use it to understand disks and partitions before mounting or formatting.

Why it matters

It gives a clean storage map.

Examples
lsblk lsblk -f
Common arguments
  • -f = include filesystem info
blkid
Permissions & Storage
Syntax
blkid [device]
When to use it

Use it when building fstab entries or identifying drives reliably.

Why it matters

UUIDs are more stable than device names like /dev/sdb1.

Examples
blkid blkid /dev/sdb1
Common arguments
  • no common flags needed for routine use
fdisk
Permissions & Storage
Syntax
fdisk [options] device
When to use it

Use it when examining or creating partitions on disks.

Why it matters

It is a core low-level storage tool.

Examples
fdisk -l fdisk /dev/sdb
Common arguments
  • -l = list partition tables
Process & System10 commands
ps
Process & System
Syntax
ps [options]
When to use it

Use it to see what is running, who owns it, and how much CPU or memory it uses.

Why it matters

It is the standard process inspection command.

Examples
ps aux ps -ef | grep php-fpm
Common arguments
  • aux = BSD full format
  • -ef = full format
top
Process & System
Syntax
top
When to use it

Use it when a server feels slow or you need live CPU/memory insight.

Why it matters

It shows the biggest resource users in real time.

Examples
top
Common arguments
  • Shift+M = sort by memory
  • Shift+P = sort by CPU
  • k = kill a process from top
htop
Process & System
Syntax
htop
When to use it

Use it when you want a friendlier version of top with easier sorting and killing.

Why it matters

It is more readable and convenient than top for many admins.

Examples
htop
Common arguments
  • F3 = search
  • F6 = sort
  • F9 = kill
kill
Process & System
Syntax
kill [signal] PID
When to use it

Use it to stop hung programs, reload daemons, or terminate jobs.

Why it matters

It gives direct control over process signals.

Examples
kill 1234 kill -15 1234 kill -9 1234
Common arguments
  • -15 = TERM, graceful stop
  • -9 = KILL, force stop
  • -HUP = hangup/reload for many daemons
killall
Process & System
Syntax
killall [options] process_name
When to use it

Use it when you know the process name but not the PID.

Why it matters

It is faster than finding each PID manually.

Examples
killall apache2 killall -9 node
Common arguments
  • -9 = force kill
  • -u USER = kill only that user's processes
pgrep
Process & System
Syntax
pgrep [options] pattern
When to use it

Use it when you need a PID for kill, renice, or inspection.

Why it matters

It avoids fragile grep pipelines.

Examples
pgrep php-fpm pgrep -a apache2
Common arguments
  • -a = show full command line
  • -u USER = match a user
pkill
Process & System
Syntax
pkill [options] pattern
When to use it

Use it when you want to stop matching processes directly without manually extracting PIDs.

Why it matters

It combines pgrep and kill into one step.

Examples
pkill apache2 pkill -f 'python app.py'
Common arguments
  • -f = match full command line
  • -u USER = match a user
uptime
Process & System
Syntax
uptime
When to use it

Use it during performance checks or after a reboot.

Why it matters

It gives a quick health snapshot in one line.

Examples
uptime
Common arguments
  • no common flags needed for routine use
free
Process & System
Syntax
free [options]
When to use it

Use it when you suspect RAM pressure or swap use.

Why it matters

It quickly answers whether memory is a bottleneck.

Examples
free -h free -m
Common arguments
  • -h = human-readable
  • -m = show in MB
vmstat
Process & System
Syntax
vmstat [interval] [count]
When to use it

Use it when diagnosing general slowness, swap, or IO wait.

Why it matters

It gives a broader performance picture than free alone.

Examples
vmstat 1 5 vmstat -s
Common arguments
  • 1 5 = sample every second 5 times
  • -s = summary stats
Shell & Scripting10 commands
echo
Shell & Scripting
Syntax
echo [text]
When to use it

Use it in scripts, quick tests, and pipelines.

Why it matters

It is a basic shell building block.

Examples
echo $PATH echo 'Hello world'
Common arguments
  • -n = no trailing newline
  • -e = enable escapes on many shells
printf
Shell & Scripting
Syntax
printf FORMAT [values]
When to use it

Use it in scripts when you need predictable formatting.

Why it matters

More reliable than echo for structured output.

Examples
printf '%s\n' "$HOME" printf '%-20s %s\n' user active
Common arguments
  • format specifiers like %s %d
xargs
Shell & Scripting
Syntax
command | xargs [other-command]
When to use it

Use it to feed lists of files or values into another command.

Why it matters

It is great for turning pipeline output into arguments.

Examples
find . -name '*.log' | xargs rm cat hosts.txt | xargs -n1 ping -c1
Common arguments
  • -n N = max arguments per command
  • -0 = use null delimiters
tee
Shell & Scripting
Syntax
command | tee [file]
When to use it

Use it when you want to see output live and save it at the same time.

Why it matters

Very useful for logging command output without losing terminal visibility.

Examples
ls -lah | tee listing.txt make 2>&1 | tee build.log
Common arguments
  • -a = append instead of overwrite
which
Shell & Scripting
Syntax
which command
When to use it

Use it when multiple versions may exist or you are unsure where a command comes from.

Why it matters

Helps debug PATH issues.

Examples
which php which python3
Common arguments
  • -a = show all matches on PATH
type
Shell & Scripting
Syntax
type name
When to use it

Use it to tell whether something is an alias, builtin, function, or executable.

Why it matters

It is often more informative than which.

Examples
type cd type php
Common arguments
  • -a = all resolutions
alias
Shell & Scripting
Syntax
alias name='command'
When to use it

Use it to shorten frequent commands or make safer defaults.

Why it matters

Speeds up repetitive terminal work.

Examples
alias ll='ls -lah' alias rm='rm -i'
Common arguments
  • no key flags; shell feature
export
Shell & Scripting
Syntax
export NAME=value
When to use it

Use it when configuring PATH, API keys, or runtime options in the current shell.

Why it matters

Many tools read behavior from environment variables.

Examples
export PATH="$HOME/bin:$PATH" export APP_ENV=prod
Common arguments
  • VAR=value = assign and export
env
Shell & Scripting
Syntax
env [NAME=value] command
When to use it

Use it to inspect variables or launch a command with temporary overrides.

Why it matters

Useful for debugging shell and app environment issues.

Examples
env | sort env APP_ENV=dev php app.php
Common arguments
  • NAME=value = temporary variable override
source
Shell & Scripting
Syntax
source file
When to use it

Use it after changing shell config files or environment setup scripts.

Why it matters

It applies changes without opening a new shell.

Examples
source ~/.bashrc
Common arguments
  • . file = shorthand syntax in POSIX shells
System Info & Services10 commands
uname
System Info & Services
Syntax
uname [options]
When to use it

Use it when checking OS architecture, kernel version, or environment compatibility.

Why it matters

It helps confirm what system you are actually on.

Examples
uname -a uname -r uname -m
Common arguments
  • -a = all info
  • -r = kernel release
  • -m = machine architecture
hostnamectl
System Info & Services
Syntax
hostnamectl [command]
When to use it

Use it when confirming host identity or changing the hostname.

Why it matters

It gives cleaner host details than older methods.

Examples
hostnamectl hostnamectl set-hostname web01
Common arguments
  • set-hostname NAME = change hostname
systemctl
System Info & Services
Syntax
systemctl [command] [unit]
When to use it

Use it to start, stop, restart, enable, disable, or inspect services.

Why it matters

It is one of the most important commands on modern Linux systems.

Examples
systemctl status apache2 systemctl restart php8.4-fpm systemctl enable mariadb
Common arguments
  • status = inspect current state
  • start|stop|restart = control service
  • enable|disable = boot-time behavior
service
System Info & Services
Syntax
service SERVICE COMMAND
When to use it

Use it on systems or guides that still reference it.

Why it matters

Useful for quick service actions, though systemctl is usually preferred.

Examples
service apache2 restart service cron status
Common arguments
  • start|stop|restart|status
journalctl
System Info & Services
Syntax
journalctl [options]
When to use it

Use it to inspect service failures, boot logs, and recent system events.

Why it matters

It is often the first place to look when a service will not start.

Examples
journalctl -u apache2 -n 100 journalctl -xe journalctl -b
Common arguments
  • -u UNIT = logs for one service
  • -n N = last N lines
  • -xe = recent errors with context
  • -b = current boot
dmesg
System Info & Services
Syntax
dmesg [options]
When to use it

Use it for hardware, driver, boot, USB, disk, and kernel error troubleshooting.

Why it matters

Kernel-level problems often show up here first.

Examples
dmesg | tail dmesg -T | grep -i usb
Common arguments
  • -T = human-readable timestamps
  • -w = follow live
whoami
System Info & Services
Syntax
whoami
When to use it

Use it when you are unsure which account or sudo context you are in.

Why it matters

Prevents running commands as the wrong user.

Examples
whoami
Common arguments
  • no common flags needed
id
System Info & Services
Syntax
id [user]
When to use it

Use it when checking group membership or permissions issues.

Why it matters

It clearly shows UID, GID, and supplementary groups.

Examples
id id www-data
Common arguments
  • user = inspect another user if permitted
who
System Info & Services
Syntax
who
When to use it

Use it on shared systems to see who is active.

Why it matters

Useful for multi-user server awareness.

Examples
who
Common arguments
  • -a = more detail on some systems
last
System Info & Services
Syntax
last [options]
When to use it

Use it when auditing access or checking reboot history.

Why it matters

It helps answer who logged in and when.

Examples
last last reboot
Common arguments
  • reboot = show reboot events
  • -n N = limit results
Viewing & Text10 commands
cat
Viewing & Text
Syntax
cat [file]
When to use it

Use it for quick reads of short config or text files.

Why it matters

It is the fastest basic file viewer.

Examples
cat /etc/os-release cat notes.txt
Common arguments
  • -n = show line numbers
  • -A = show non-printing characters
less
Viewing & Text
Syntax
less [file]
When to use it

Use it for logs, configs, and long command output.

Why it matters

It is far easier than cat for large files.

Examples
less /var/log/syslog journalctl -xe | less
Common arguments
  • /pattern = search forward inside less
  • N = next match
  • G = end of file
head
Viewing & Text
Syntax
head [options] [file]
When to use it

Use it to inspect headers, config starts, or CSV columns.

Why it matters

It avoids opening an entire large file.

Examples
head -20 access.log head -n 5 users.csv
Common arguments
  • -n N = number of lines
tail
Viewing & Text
Syntax
tail [options] [file]
When to use it

Use it for log troubleshooting, watching cron output, or seeing the newest lines.

Why it matters

It is one of the most useful commands for diagnostics.

Examples
tail -50 /var/log/syslog tail -f cron.log
Common arguments
  • -n N = last N lines
  • -f = follow appended lines
grep
Viewing & Text
Syntax
grep [options] pattern [file]
When to use it

Use it to find errors, config values, IPs, usernames, or keywords in output and files.

Why it matters

It narrows huge amounts of text down to what matters.

Examples
grep -i error /var/log/syslog ps aux | grep apache grep -R 'ServerName' /etc/apache2
Common arguments
  • -i = case-insensitive
  • -n = show line numbers
  • -R = recursive
  • -v = invert match
  • -E = extended regex
sed
Viewing & Text
Syntax
sed [options] 'script' [file]
When to use it

Use it for quick in-place edits, substitutions, or extracting lines in scripts.

Why it matters

It is faster than opening a file manually for simple text changes.

Examples
sed -n '1,20p' file.txt sed 's/http/https/g' config.txt sed -i 's/old/new/g' file.php
Common arguments
  • -n = suppress automatic printing
  • -i = edit in place
  • s/old/new/g = substitute globally
awk
Viewing & Text
Syntax
awk 'program' [file]
When to use it

Use it for column-based logs, CSV-like data, or report summaries.

Why it matters

It is excellent for parsing structured text on the command line.

Examples
awk '{print $1,$9}' access.log df -h | awk 'NR==1 || /\/dev\//' awk -F: '{print $1}' /etc/passwd
Common arguments
  • -F = field separator
  • NR = record number
  • $1 $2 ... = fields
sort
Viewing & Text
Syntax
sort [options] [file]
When to use it

Use it to order output before review, diffing, or counting.

Why it matters

Sorted data is easier to compare and summarize.

Examples
sort users.txt sort -nr sizes.txt sort -u list.txt
Common arguments
  • -n = numeric sort
  • -r = reverse
  • -u = unique
uniq
Viewing & Text
Syntax
uniq [options] [file]
When to use it

Use it after sort to count repeated values such as IPs, paths, or users.

Why it matters

It helps summarize repeated data quickly.

Examples
sort access.log | uniq -c sort ips.txt | uniq
Common arguments
  • -c = count occurrences
  • -d = show duplicates only
  • -u = show unique only
cut
Viewing & Text
Syntax
cut [options] [file]
When to use it

Use it when you only need a small slice of structured text.

Why it matters

It is lightweight and simple for delimiter-based extraction.

Examples
cut -d: -f1 /etc/passwd cut -c1-20 file.txt
Common arguments
  • -d = delimiter
  • -f = fields
  • -c = character positions
Practical notes

Many of the most useful Linux troubleshooting patterns come from combining commands. A few very common combos are command | grep pattern for narrowing output, tail -f logfile while reproducing an issue, find ... -mtime for recently changed files, and systemctl status + journalctl -u service for service failures.

When changing anything important, it is usually worth doing three things first: confirm the current location with pwd, inspect the target with ls -lah or stat, and make a backup with cp file file.bak.

For production troubleshooting, the biggest time-savers are usually: knowing how to inspect logs, understanding disk usage, checking process state, verifying permissions and ownership, and testing whether a service is actually listening on the expected port.