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 theSIGTERMsignal to all the processes belonging to the job itself:
zarrelli:~$ sleep 100 &
[1] 9909
zarrelli:~$ kill %1
zarrelli:~$
[1]+ Terminated sleep 100You 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 -9will send a SIGKILL, which will instantly terminate a process.
Which signals can we send to a process? Eitherkill -lorcat /usr/include/asm-generic/signal.hwill 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 thekillallcommand followed by the name of the process:
zarrelli:~$ sleep 100 &
[1] 10595
zarrelli:~$ killall sleep...