From 89029fbee88b40d6f2ddc54a5e6ecfe4a646ade2 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 7 Jul 2025 21:51:41 +0330 Subject: [PATCH] lipc1 doc: kill command --- Linux/LPIC1/17-kill.md | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Linux/LPIC1/17-kill.md diff --git a/Linux/LPIC1/17-kill.md b/Linux/LPIC1/17-kill.md new file mode 100644 index 0000000..38f8bac --- /dev/null +++ b/Linux/LPIC1/17-kill.md @@ -0,0 +1,68 @@ +# πŸ—‘οΈ Kill Command + +The `kill` command is used to **send signals to processes**, typically to terminate or control them. + +```bash +kill [options] +``` + +πŸ“Œ Replace `` with the Process ID of the target process. + +--- + +## 🚦 Common `kill` Usage Examples + +### πŸ’€ Graceful Termination β€” `SIGTERM` (Signal 15) + +```bash +kill 123 +``` + +βœ… Politely asks the process to terminate. +*Allows the process to clean up before exiting.* + +--- + +### πŸͺ“ Force Kill β€” `SIGKILL` (Signal 9) + +```bash +kill -9 123 +``` + +πŸ’₯ **Immediate termination**. +*Doesn’t allow cleanup β€” use only when necessary.* +πŸ—‘οΈ *Think of it as the "katana" of kill commands.* + +--- + +### ⌨️ Interrupt β€” `SIGINT` (Signal 2) + +```bash +kill -2 123 +``` + +πŸ›‘ Mimics pressing `Ctrl + C`. +*Often used to stop processes gracefully from the terminal.* + +--- + +### πŸ”„ Hangup β€” `SIGHUP` (Signal 1) + +```bash +kill -1 123 +``` + +♻️ Requests the process to **reload or restart**. +*Commonly used for daemons or services to reload configs.* + +--- + +## πŸ“‹ Summary of Signals + +| Signal | Name | Description | +| ------ | --------- | ------------------------------ | +| `1` | `SIGHUP` | Reload configuration / restart | +| `2` | `SIGINT` | Interrupt (like Ctrl + C) | +| `9` | `SIGKILL` | Force kill (cannot be ignored) | +| `15` | `SIGTERM` | Graceful termination (default) | +