Linux Terminal Command: kill
The kill command is an essential tool in Process & Job Control. In this tutorial, we will explore what kill does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.
Concept & Explanation
The kill command terminates processes by sending a signal. The default signal is SIGTERM (15), which asks the process to exit cleanly.
Common Options & Syntax
kill [options] [arguments]
Here are the most common flags used with kill:
- Simple Usage: Basic default commands.
- Detailed View: Shows diagnostic information.
- Advanced Actions: Can chain parameters for scripting.
1. Interactive Example (Simple)
Here is how most people run the command:
# Example
kill 1234
What it does: Sends SIGTERM to process ID 1234, asking it to close cleanly.
2. Power-User Example (Advanced)
For scripting and advanced diagnostics, use this configuration:
# Advanced
kill -9 5678
What it does: Sends SIGKILL (9) to process ID 5678. SIGKILL cannot be ignored and terminates the process instantly without saving files.
⚙️ Warning & Common Pitfalls
[!WARNING] Always try running regular
kill(SIGTERM) first. Only usekill -9(SIGKILL) as a last resort, as it can cause database corruption or leave lockfiles behind.
🔗 Related Commands
Here are some related posts on cli_tty1 you might want to check out: