Linux & shell: Performance & tracing
10 Linux & shell commands: Performance & tracing. Click a command to see what each part does.
Linux & shell: Performance & tracingIndex
- Whole sheet251
- Navigate & list13
- Create, copy, move, delete13
- View & compare files9
- Permissions & ownership31
- Help & shell basics11
- Users & groups6
- Install packages7
- Package & software versions29
- System info9
- Network basics & SSH10
- Zip & compress4
- Shell operators6
- Processes6
- Files & search8
- Text processing pipelines4
- Disk3
- Network5
- Services & logs6
- Archives & copying4
- Firewall7
- Scheduling: cron & systemd timers6
- Storage, mounts & LVM10
- Kernel, hardware & limits8
- Performance & tracing10
- TLS & certificates8
- Packet capture & network debugging10
- Terminal tools8
Performance & tracing10
vmstat 1 5CPU, memory, swap and I/O wait every secondWhat each part does
vmstatr (run queue), free memory, si/so (swapping), wa (I/O wait), us/sy/id CPU1 5every 1 second, 5 times (the first line is the average since boot)
iostat -xz 1Disk I/O per deviceWhat each part does
iostatdisk statistics (sysstat package)-xextended: %util, await (latency), r/s, w/s-zhide idle devices1refresh every second
mpstat -P ALL 1CPU usage per coreWhat each part does
mpstatCPU statistics (sysstat)-P ALLevery core, to spot one core at 100%1every second
pidstat -u -r -d 1CPU, memory and I/O per process over timeWhat each part does
pidstatper-process statistics (sysstat)-u -r -dCPU, memory (faults, RSS) and disk I/O1every second
sudo iotop -oPaWhich processes do the most disk I/O?What each part does
iotoptop for disk I/O-oonly processes actually doing I/O-Pper process, not per thread-aaccumulated totals
ps -eo pid,user,%mem,rss,cmd --sort=-rss | head -15Top memory usersWhat each part does
ps -eo ...pick columns: PID, user, % of RAM, resident memory in KB, command--sort=-rssbiggest memory first| head -15top 14 plus the header
sudo strace -f -tt -p <pid> -e trace=network,fileTrace what a process is doing (system calls)What each part does
strace -p <pid>attach to a running process-ffollow its threads and children-tttimestamps with microseconds-e trace=network,fileonly network and file calls (drop it to see everything)
Tip Slows the process down a lot; use briefly in production.
sudo perf topLive CPU profile of the whole systemWhat each part does
perf topfunctions using the most CPU right now, across kernel and user space
sar -n DEV 1Network traffic per interfaceWhat each part does
sar -n DEVpackets and KB per second per interface (sysstat)1every second; sar without a count reads history if sysstat collection is enabled
watch -n 2 -d '<command>'Re-run a command every few secondsWhat each part does
watchrun the command repeatedly, full-screen-n 2every 2 seconds-dhighlight what changed
Nothing matches.
My DevOps Playbook by Angelo John Calleja