Ten questions you eventually need to answer on a live Linux box - and the one-liner for each. Most need sudo to see everything (attaching to another user’s process, reading capabilities across the tree, per-process I/O).

TaskCommand
Change a process’s CPU affinitytaskset -cp 0-3 <pid> - pin PID to CPUs 0–3. Launch pinned: taskset -c 0,2 <cmd>
Modify a process’s I/O priorityionice -c2 -n0 -p <pid> - class 2 (best-effort), level 0 (highest). Class 3 = idle
Intercept an app’s system callsstrace -p <pid> to attach; strace <cmd> to launch. Add -f for child threads, -e trace=network to filter
View a binary’s shared-library depsldd /path/to/binary (or objdump -p bin | grep NEEDED for the direct deps only)
Change a kernel variable at runtimesudo sysctl -w net.ipv4.ip_forward=1. Persist it in /etc/sysctl.d/99-local.conf + sysctl --system
Check network-interface drop countersip -s link show eth0 (RX/TX errors + dropped). Deeper: ethtool -S eth0
List extended file capabilitiesgetcap -r / 2>/dev/null (whole tree) or getcap <file>. Set with setcap
Monitor real-time disk I/O per processsudo iotop (interactive). Scriptable: pidstat -d 1
Display active shared-memory segmentsipcs -m (System V shm); ipcs for all IPC (queues, semaphores)
Find the PID using a specific portsudo ss -ltnp 'sport = :8080' (or sudo lsof -i :8080, or sudo fuser 8080/tcp)

A few notes

  • taskset / ionice change scheduling, not the program - the process keeps running; you’re just telling the kernel where and how eagerly to run it.
  • strace is a debugging superpower (see exactly what syscalls an app makes and where it hangs) but it slows the target - don’t leave it attached in production.
  • sysctl -w is runtime-only; it resets on reboot unless you drop it in /etc/sysctl.d/. That split (live tweak vs. persisted) trips people up constantly.
  • getcap shows Linux capabilities (fine-grained root powers like cap_net_bind_service), which are separate from file permissions and ACLs (getfacl) and attributes (lsattr).
  • ss has replaced netstat on modern systems - same job, faster, still installed everywhere.