Job controls
So, we have the job ID, process ID, foreground, and processes, but how do we control these jobs? We have a bunch of commands available, let's have a look at how to use them:
kill
: We can pass the job ID to this command, which will send theSIGTERM
signal to all the processes belonging to the job itself:
zarrelli:~$ sleep 100 &
[1] 9909
zarrelli:~$ kill %1
zarrelli:~$
[1]+ Terminated sleep 100
You can also pass to kill a specific signal to send to the process. For instance, kill -15
will nicely terminate a process with a SIGTERM
signal, and if it refuses to die, kill -9
will send a SIGKILL
, which will instantly terminate a process.
Which signals can we send to a process? Eitherkill -l
orcat /usr/include/asm-generic/signal.h
will give us a list of all the signals supported.
killall
:If we know what is the name of the process, the easiest way to kill it is through thekillall
command followed by the name of the process:
zarrelli:~$ sleep 100 &
[1] 10595
zarrelli:~$ killall sleep...