Three quick-reference tables tuned by role—most-used commands with the flags that matter.
Click Copy sheet for plain text, or use your browser print dialog (Cmd/Ctrl+P) for a printable version.
devsysadmininfra
Developer Cheat Sheet
Daily CLI: repos, logs, local processes, text munging, HTTP checks.
dev
Files & search
Command
Example
Use when
ls
ls -la
List all files with permissions
cd
cd -
Toggle previous directory
pwd
pwd -P
Resolve symlinks in path
find
find . -name '*.ts'
Locate files in tree
grep
grep -rn "TODO" src/
Search code recursively
rg
rg -l pattern
Faster ripgrep search (if installed)
tree
tree -L 2 -I node_modules
Visualize project layout
View & edit
Command
Example
Use when
cat
cat .env.example
Small file to stdout
less
less +F app.log
Follow log live
tail
tail -n 200 -f log
Last lines + follow
head
head -n 5 file.csv
Peek header rows
wc
wc -l *.log
Line counts
Text processing
Command
Example
Use when
sed
sed -i.bak 's/old/new/g' f
In-place replace
awk
awk '{print $1}' log
Column extraction
sort
sort -u file.txt
Unique sorted lines
uniq
sort f | uniq -c
Count duplicates
xargs
find . -name '*.tmp' -print0 | xargs -0 rm
Safe batch delete
Processes & sessions
Command
Example
Use when
ps
ps aux | grep node
Find dev server PID
kill
kill -TERM $PID
Stop hung dev server
lsof
lsof -i :3000
Who owns port 3000
tmux
tmux new -s dev
Persistent terminal session
jobs
fg %1
Background job control
Network & archives
Command
Example
Use when
curl
curl -fsS localhost:8080/health
API health check
ssh
ssh -L 5432:localhost:5432 db
Local port forward to DB
scp
scp build.zip user@host:/tmp/
Copy artifact to server
tar
tar -czvf out.tgz dir/
Archive for deploy
tar
tar -xzvf in.tgz
Extract release
Shell shortcuts
Syntax
Example
Use when
|
cat log | grep ERR
Pipeline filter
2>&1
cmd >out.log 2>&1
Merge stderr to stdout
$?
echo $?
Last exit code
export
export NODE_ENV=dev
Env for child processes
history
Ctrl+r
Reverse search history
SysAdmin Cheat Sheet
Users, permissions, services, packages, logs, and scheduled jobs.
sysadmin
Users & access
Command
Example
Use when
id
id deploy
UID, groups for account
useradd
useradd -m -s /bin/bash u
Create login user
usermod
usermod -aG sudo u
Add to group
passwd
passwd -l u
Lock account
sudo
sudo -l
List allowed commands
visudo
visudo
Edit sudoers safely
who
w
Logged-in sessions
Permissions
Command
Example
Use when
chmod
chmod 600 id_rsa
SSH key permissions
chmod
chmod -R g+w /var/shared
Group-writable share
chown
chown -R www-data:www-data /var/www
Web root owner
umask
umask 027
Default new file modes
getfacl
getfacl /data/share
Inspect ACLs
Services (systemd)
Command
Example
Use when
systemctl
systemctl status nginx
Service state
systemctl
systemctl restart nginx
Apply config (after test)
systemctl
systemctl reload nginx
Graceful reload (SIGHUP)
systemctl
systemctl enable --now u
Start on boot
journalctl
journalctl -u nginx -f
Follow service logs
journalctl
journalctl -p err -b
Errors this boot
Packages
Command
Example
Use when
apt
apt update && apt upgrade -y
Debian/Ubuntu patch
apt
apt install pkg
Install package
dnf
dnf install pkg
RHEL/Fedora install
rpm
rpm -qa | grep pkg
Query installed RPM
dpkg
dpkg -l | grep pkg
Query installed deb
Disk & logs
Command
Example
Use when
df
df -h
Filesystem space
df
df -i
Inode exhaustion
du
du -sh /var/log/*
Log directory sizes
tail
tail -f /var/log/syslog
Classic syslog follow
logrotate
logrotate -d /etc/logrotate.conf
Debug rotation config
Scheduling
Command
Example
Use when
crontab
crontab -e
Edit user cron
crontab
crontab -l
List jobs
at
echo cmd | at 02:00
One-shot schedule
systemctl
systemctl list-timers
systemd timers
Infra / DevOps Cheat Sheet
Networking, storage, performance, remote ops, and incident triage.