All cheatsheets

Cheatsheets

Linux admin

systemd, users & permissions, packages, processes, and networking commands.

Visualize

Linux — file permissions (rwx ↔ octal)

Each octal digit is r(4) + w(2) + x(1) for owner, group, other — toggle the bits and watch chmod update.

presets
readwriteexecute
owner6
group4
other4
symbolicrw-r--r--
octal644
chmodchmod 644 file

Each digit is one class: r=4 + w=2 + x=1. So 7=rwx, 5=r-x, 4=r--, 6=rw-.

Virtual memory — paging (3D)

The MMU maps each contiguous virtual page to any scattered physical frame via the page table.

Loading 3D…

31 entries

System & services7

systemctl status <svc>

Recipe: diagnose why a service won't start.

systemctl start|stop|restart <svc>

Control a service

systemctl enable --now <svc>

Start now + on boot

journalctl -u <svc> -f

Follow a service's logs

uname -a / hostnamectl

Kernel / host info

uptime / top / htop

Load & live processes

free -h / df -h

Memory / disk usage

Users & permissions7

sudo <cmd>

Run as root

useradd -m -s /bin/bash bob

Create a user with a home

passwd bob

Set a password

usermod -aG sudo bob

Add user to a group

chown user:group file

Change ownership

chmod 750 dir

Set permissions — read the octal as owner/group/other.

id / groups

Show current user's ids/groups

Packages5

apt update && apt upgrade

Debian/Ubuntu update

apt install <pkg>

Install (apt)

dnf install <pkg>

Install (Fedora/RHEL)

pacman -S <pkg>

Install (Arch)

which <cmd> / type <cmd>

Locate a command

Processes & disk6

ps aux | grep <name>

Recipe: find and stop a runaway process.

kill -9 <pid> / pkill <name>

Force-terminate a process.

nice / renice

Adjust process priority

lsof -i :<port>

What's using a port

du -sh * | sort -h

Recipe: find what's filling the disk.

mount / lsblk

Mounts / block devices

Networking & transfer6

ip a / ip route

Interfaces / routes

ss -tulpn

Listening sockets

ufw allow 22/tcp

Firewall rule (Ubuntu)

ssh user@host

Remote shell

scp file user@host:/path

Copy over SSH

rsync -avz src/ host:/dst/

Efficient incremental sync over SSH.