From the fine manual page:
kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
kill -l [sigspec | exit_status]
Send the signal named by sigspec or signum to the processes named by pid or
jobspec. sigspec is etc. etc....
So what decides whether kill 1
kills the init process or jobspec 1?
On Unix-like operating systems, kill is a builtin command of the Bash shell. It sends a signal to a process. This page covers the bash builtin version of kill, which is distinct from the standalone binary executable, /bin/kill. To figure out which of these is the default kill on your system, run type kill.
A job specification or "jobspec" is a way of referring to the processes that make up a job. A jobspec may be: %n to refer to job number n . %str to refer to a job which was started by a command beginning with str . It is an error if there is more than one such job.
We can use “ps augx” to list all processes and the locate those with keyword by using “grep keyword” command. Next, we need to split each line by whitespace delimiter and list the second column which is the process ID. Finally, we feed into xargs command to kill them.
with kill 1 you will send a signal to process with pid 1. To kill job 1 you have to type
kill %1
the jobspec is %
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With