Processes Flashcards
What are the different process states?
R: running
Z: Zombie (including Z, X)
T: Stopped
S: Sleeping (including S, D, K, I)
ps aux
displays all processes including processes without a controlling terminal
ps lax
long listing (lax options) provides more detail, and gives faster results by avoiding username lookup
display the processes in a tree format
ps –forest
display the list of jobs for the shell’s session
jobs
bring a background job to the foreground
fg %1
displays information about jobs.
ps j
when running the “ps j” command, one job has the + sign. explain
sign indicates that this job is the current default
when running the “ps j” command, one job has the - sign. explain
The - sign indicates the previous job that will become the default job when the current default job finishes.
List the signals available
kill -l
Common signals
1: HUP
3: QUIT
9: KILL
15: TERM (default)
18: CONT
19: STOP
List all processes related to user bob
pgrep -l -u bob
Kill all processes related to user bob
pkill -SIGKILL -u bob
Find all terminals that bob is logged in from
w -u
Kill all processes related to a given terminal
pkill -SIGKILL -t tty2
Which signals are recommended and in which order?
SIGTERM
SIGINT
SIGKILL
kill multiple processes, based on their command name
killall
To terminate background job
kill -SIGTERM %1
What is pts/1
1) pseudo-terminals
2) emulated terminals: xterm, Gnome, SSH etc.
What is tty/2
1) TTY: direct interfaces with the kernel.
2) Traditionally physical terminals,
3) Originally teletypewriters, connected directly to the system.
4) Nowadays, virtual consoles accessed typically through key combinations like Ctrl+Alt+F1 to F6.
5) multi-user.target, rescue.target, emergency.target
display the current load average
uptime, top
Show cpus
lscpu