Processes
20 articles, grouped by kind; the order follows the tracks.
Concepts 10
-
System monitoring: where to start when the server is slow
The order of checks for "the server is slow": CPU, memory, disk, kernel and network — what shows each resource.
8 minvmstattopfree -h -
Load average: how many tasks wait for the CPU and the disk
The average number of tasks running or waiting for a CPU (R) or for the kernel (D) over 1, 5 and 15 minutes.
12 minuptimenproccat -
/proc: processes and the kernel as files
/proc is a filesystem where the kernel shows processes (/proc/<pid>) and its own state: memory, load, parameters.
11 minlsgrep -Els -l -
Memory and swap: free, available and the page cache
How to read free: used and free memory, the page cache and available; swap, a swap file and vm.swappiness.
11 minfree -hgrep -Eps -eo -
Processes
Viewing processes, signals and priorities; finding the processes that hog CPU or memory.
5 minps auxps -eopgrep -a -
OOM killer: when memory runs out
A kernel mechanism: when memory runs out on the machine or in a cgroup with a limit, it kills a process with SIGKILL.
12 minjournalctl -ksystemctl showcat -
Background jobs in the shell — &, jobs, nohup
Running things in the background, shell job control, surviving logout.
4 mincmdjobs -lfg -
Unix sockets — processes talking through a file
A unix socket is a file through which processes on one machine exchange data; connecting needs write permission on it.
9 minls -lstat -css -xl -
ulimit and process limits: open files, processes, core
Process resource limits — open files, processes, core: ulimit, /proc/<pid>/limits and a service LimitNOFILE.
8 minulimit -aulimitulimit -Sn -
cgroups and namespaces — how containers work
Isolation (namespaces) and resource limits (cgroups) — the foundation of containers and systemd.
6 minlsnssystemd-cglssystemd-cgtop
Commands 10
-
stress-ng — timed load on the CPU, memory and disk
stress-ng puts load on the CPU, memory and disk for a set time — for experiments with load, OOM and disk I/O.
9 minstress-ng --cpustress-ng --vmstress-ng --hdd -
iostat and pidstat — which disk is busy and which process loads it
iostat shows disk load — requests, latency, %util; pidstat shows CPU, memory and disk usage per process.
8 miniostat -dxsyiostat -xpidstat -dl -
ps — list processes
The ps command lists running processes with PID, owner, state, CPU and memory use, and the command line.
5 minpsps auxps -ef -
top — processes and load in real time
The top program refreshes the process list, CPU load, memory and load average every few seconds.
5 mintoptop -otop -u -
kill — send a signal to a process
The kill command sends a signal to a PID — ask it to exit (TERM), reload settings (HUP), or end it at once (KILL).
6 minkillkill -TERMkill -HUP -
pgrep — find a process PID by name
The pgrep command prints the PIDs of processes by name or command line, owner and parent — no ps or grep needed.
5 minpgrep nginxpgrep -lpgrep -a -
lsof — open files and ports of processes
lsof shows which process holds a file, a port, or a deleted file that is still open.
6 minlsof -ilsoflsof -p -
strace — which system calls a process makes
strace shows the system calls of a program and their results: a file that did not open, a failed connect, a wait.
8 minstrace catstrace -fstrace -e -
sleep — delay execution
Pauses execution for a specified duration; does not test whether another program is ready.
4 minsleepsleep --help -
wait — wait for a child task in Bash
A Bash builtin that waits for a child task and returns its completion status.
4 mintype waithelp waitsleep
Nothing found. Try a shorter query.