Differences
This shows you the differences between two versions of the page.
linux_wiki:kill [2016/06/12 16:16] billdozor |
linux_wiki:kill [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== kill ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | kill is the command to send signals to processes. | ||
- | |||
- | **Checklist** | ||
- | * Distro(s): Any | ||
- | |||
- | ---- | ||
- | |||
- | ====== Kill Signals ====== | ||
- | |||
- | List kill signals | ||
- | <code bash> | ||
- | kill -l | ||
- | </ | ||
- | \\ | ||
- | |||
- | Some of the more often used signals: | ||
- | |||
- | ^ Signal # ^ Signal Name ^ Description | ||
- | | 1 | HUP | Hangup (daemons re-read config file) | Yes | | ||
- | | 9 | KILL | Kill immediately, | ||
- | | 15 | TERM | Software termination request, process cleans up and exits **(default)** | ||
- | |||
- | ---- | ||
- | |||
- | ====== Kill Syntax ====== | ||
- | <code bash> | ||
- | kill [-signal] pid | ||
- | </ | ||
- | |||
- | * -signal : can be the signal number or name | ||
- | * pid : process id of the target | ||
- | |||
- | If -signal is ommited, kill sends -15 (TERM) by default. | ||
- | |||
- | ---- | ||
- | |||
- | ====== Kill Examples ====== | ||
- | |||
- | Ask apache to re-read its configuration file after changes have been made. (Assumes httpd is pid 2123) | ||
- | <code bash> | ||
- | kill -1 2123 | ||
- | </ | ||
- | |||
- | or | ||
- | |||
- | <code bash> | ||
- | kill -HUP 2123 | ||
- | </ | ||
- | |||
- | Ask apache to terminate gracefully: | ||
- | <code bash> | ||
- | kill 2123 | ||
- | </ | ||
- | |||
- | Tell the kernel to immediately kill apache: | ||
- | <code bash> | ||
- | kill -9 2123 | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== pkill ====== | ||
- | |||
- | Kill process by name (instead of PID) | ||
- | <code bash> | ||
- | pkill httpd | ||
- | </ | ||
- | * Kills all process ids named httpd, sending signal 15 (SIGTERM) | ||
- | |||
- | \\ | ||
- | Remove a user's ssh session (kick user off system) | ||
- | <code bash> | ||
- | pkill -u rjones sshd | ||
- | </ | ||
- | |||
- | \\ | ||
- | Kill all processes started from a specific terminal | ||
- | <code bash> | ||
- | pkill -t pts/1 | ||
- | </ | ||
- | * This does NOT kick them off the system, only kills their running programs started from that session. | ||
- | |||
- | ---- | ||