Process management Flashcards
List all processes running on the system
List tree view of all processes running on the system
List processes showing status of processes
ps -aux
ps -efH
ps -el
Find process by name, also show its pid
pgrep -l httpd
Kill process matching specified name
pkill httpd
killall httpd
Show all process names running by specific user
pgrep -u user -l
Kill process with exact specified name
pkill -x vi
Find all processes not own by specified user
pgrep -v -u user -l
List all kill signals
kill -l
Most useful signals
- kill -1 or kill SIGHUP- hangup of controlling terminal
Same as to closing terminal window on the right upper corner - kill -2 or kill SIGINT -interruption from keyboard. Same as pressing Ctrl+C
- kill -15/kill -SIGTERM
Default signal when killing a processes - kill -9/ kill -SIGKILL - kill process immediately
- kill -18/ kill -SIGCONT
kill -19/ kill -SIGSTOP
SIGSTOP is the same as Ctrl-Z
stop the process
When SIGSTOP is sent to a process, the usual behaviour is to pause that process in its current state. The process will only resume execution if it is sent the SIGCONT signal. SIGSTOP and SIGCONT are used for job control in the Unix shell
Kill a terminal running by specified user
- w
find terminal using by specified user - pkill -t pts/1
Set priority of the process
nice [from -20 to 19]
nice -n 10 ping google.com
nice -n 1 httpd
(The higher the number the lower the priority)
Change priority of the process
renice -n 5 -p 1234
renice -n 10 $(pgrep httpd)
CPU info in pseudo fs
cat /proc/cpuinfo