Resource usage

2 snippets across 2 stacks — Bash & Linux, Docker

SHBash & Linux

Interactive Process Viewer

SH · Process Management
syntax
top
htop
example
top -o %MEM
htop -u deploy

Note top is always available. In top: press M to sort by memory, P by CPU, k to kill a process, q to quit. htop is a friendlier alternative with mouse support, color, and tree view but may need installing. -u filters by user.

DKDocker

Live Resource Usage

DK · Containers
syntax
docker stats [container...]
example
docker stats
docker stats web-api db-postgres --no-stream
output
CONTAINER   CPU %   MEM USAGE / LIMIT     NET I/O         BLOCK I/O
web-api     0.50%   85.2MiB / 512MiB      1.2kB / 648B    0B / 4.1kB

Note Without arguments, it shows all running containers. Add --no-stream to get a single snapshot instead of a live-updating display.