processes
Process management and control
-
fuser
Tested fuser examples: which processes hold a file, what is keeping a filesystem busy, reading the access letters, and killing the holders with -k.
-
job control
Tested jobs, fg, bg, disown and nohup examples: the jobs table, job specs like %1, suspending and resuming, and why none of it works in a script.
-
kill
Tested kill, pkill and killall examples: choosing a signal, why -9 is a last resort, matching by name or command line, and signalling a whole process group.
-
lsof
Tested lsof examples: what has a file open, which process holds a port, finding a deleted file that is still using disk space, and narrowing the output.
-
ps
Tested ps examples: aux versus -ef, choosing columns with -o, selecting by user or name, sorting, the process tree, and pgrep instead of grep.
-
ss
Tested ss examples: listing listening sockets, finding the process holding a port, filtering by state and address, and reading the queue columns.
-
systemctl
Tested systemctl examples: starting and stopping services, enabling them at boot, reading unit state, drop-in overrides, and diagnosing failures.
-
top
Tested top examples: the summary lines, the process columns, sorting and filtering in batch mode, threads, and reading a process's memory and CPU.
-
xargs
Tested xargs examples: batching with -n, placeholders with -I, NUL-separated input from find -print0, parallel runs with -P, and what its exit codes mean.
-
Processes and signals
How processes are born, orphaned and reaped, what a signal actually does, why kill -9 is a last resort, and why Ctrl-C stops a whole pipeline at once.
-
Terminal, shell and tty
What a terminal, a tty, a shell and a console each actually are, why Ctrl-D is not a signal, and why Ctrl-S appears to freeze everything.
-
Keep a program running after you log out
How to stop a long job dying when an ssh session ends, what each approach really does about SIGHUP, and an honest recommendation between them.
-
Find and kill whatever is using a port
Identify the process bound to a TCP port that's refusing to let a service start, then stop it.
-
A service won't start
A service will not come up, and systemctl either reported a job failure or stayed silent. Read the status, read the journal, then branch on the code.
-
Text file busy
A deploy failed because the program is running. What ETXTBSY protects, why rm then copy works, and the rename that avoids the window between them.
-
Why is this process using so much CPU?
The machine is slow and one process is at the top of top. Find it, check whether the figure means what it seems to, see what it is doing, and make it give way.
-
Why is this process using so much memory?
A process looks huge in top, or free shows almost nothing free. Check whether memory is really short, which of RSS, VSZ and PSS to believe, and how to limit it.