Use the kill command to send a signal to each process specified by a pid (process identifier). The default signal is SIGTERM (terminate the process).
Syntax
kill PID
kill -s signalName PID
kill -9 PID
Common UNIX Signal Names and Numbers
All available UNIX signals have different names, and are mapped to certain numbers as described below.Number | Name | Description | Used for |
---|---|---|---|
0 | SIGNULL | Null | Check access to pid |
1 | SIGHUP | Hangup | Terminate; can be trapped |
2 | SIGINT | Interrupt | Terminate; can be trapped |
3 | SIGQUIT | Quit | Terminate with core dump; can be |
9 | SIGKILL | Kill | Forced termination; cannot be trapped |
15 | SIGTERM | Terminate | Terminate; can be trapped |
24 | SIGSTOP | Stop | Pause the process; cannot be trapped |
25 | SIGTSTP | Terminal | stop Pause the process; can be |
26 | SIGCONT | Continue | Run a stopped process |
man 5 signal
Examples: Send a Kill Single To Process ID 1414
Use the following command to kill pid 4242 and exit gracefully:kill 4242To find pid of any job or command use ps command:
ps | grep commandThe following all are equivalent commands with -9 SIGKIL (i.e forcefully kill 1414 process):
ps aux | grep command
ps aux | grep apache
kill -s SIGKILL 1414
kill -s KILL 1414
kill -s 9 1414
kill -SIGKILL 1414
kill -KILL 1414
No comments:
Post a Comment