$ yes > /dev/null &[1] 3706The command above will start process syes and output its standard output to /dev/null . What we are interested in here, is the second line which contains the following information "[1]" ( job ID ) and "3706" the actual PID. On your Linux system you can run multiple process at any given time and each process, depending on the user privileges can be terminated using either kill or killall commands. Let's start few additional processes:
$ yes > /dev/null &[2] 3782$ yes > /dev/null &[3] 3783$ yes > /dev/null &[4] 3784$ yes > /dev/null &[5] 3785From the above you can see that we have started additional processes using yes command and that each process have different PID. To list all you processes forked from the current shell use jobs command:
$ jobs[1] Running yes > /dev/null &[2] Running yes > /dev/null &[3] Running yes > /dev/null &[4]- Running yes > /dev/null &[5]+ Running yes > /dev/null &The difference between kill vs killall commands is that with kill command we can terminate only a single process at the time, whereas with killall command we are able to terminated multiple processes based on given criteria such as process group, process age or user ownership. Let's use kill command to kill process with PID 3783:
$ kill 3783[3] Terminated yes > /dev/nullTerminating each process one by one can prove to be a hard and tedious work. Let's see whether we can get some help by using killall command and process name:
$ killall yes[1] Terminated yes > /dev/null[2] Terminated yes > /dev/null[4]- Terminated yes > /dev/null[5]+ Terminated yes > /dev/nullAs you can see all processes were terminated based on the process name.