Linux Comm Kill
# Linux kill Command
[ Linux Command Manual](#)
The Linux kill command is used to terminate a running process.
The kill command can send different signals to a target process to achieve different operations. If no signal is specified, it defaults to sending the TERM signal (15), which terminates the process. If the program still cannot be terminated, you can try using the SIGKILL (9) signal to force delete the program.
### Syntax
kill
is the process ID of the process to be terminated.
**Parameter Description**:
* `-l`: List all available signals.
* `-`: Send a specific signal to the target process, e.g., `-9` sends the KILL signal, which forcefully terminates the process.
### Basic Usage
**Terminate Process:** By default, the kill command sends SIGTERM (signal 15), which requests the process to terminate. If the process does not catch this signal, it will be terminated.
kill PID
Where PID is the ID of the process.
**Send Specified Signal:** You can send a specified signal using the -s option.
kill -s SIGNAL PID
For example, sending SIGKILL (signal 9) will immediately end the process, and it cannot be ignored or caught.
kill -9 PID
**Kill Process Group:** Use the -9 option to kill an entire process group.
kill -9 -PID
Use the kill -l command to list all available signals.
The most commonly used signals are:
* `SIGKILL` (signal 9): Immediately ends the process, cannot be caught or ignored.
* `SIGTERM` (signal 15): Normally ends the process, can be caught or ignored.
* `SIGSTOP` (signal 19): Pauses the process, cannot be caught, ignored, or ended.
* `SIGCONT` (signal 18): Continues execution of a paused process.
* `SIGINT` (signal 2): Usually the signal generated by Ctrl+C, can be caught or ignored by the process.
### Examples
Terminate the process with PID 1234:
kill 1234
Forcefully terminate the process with PID 1234:
kill -9 1234
Send SIGSTOP to the process with PID 1234:
kill -s SIGSTOP 1234
Display signals
# kill -l1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL10) SIGUSR1 11) SIGSEGV12) SIGUSR213) SIGPIPE14) SIGALRM15) SIGTERM 16) SIGSTKFLT17) SIGCHLD18) SIGCONT19) SIGSTOP20) SIGTSTP 21) SIGTTIN22) SIGTTOU23) SIGURG24) SIGXCPU25) SIGXFSZ 26) SIGVTALRM27) SIGPROF28) SIGWINCH29) SIGIO30) SIGPWR 31) SIGSYS34) SIGRTMIN35) SIGRTMIN+136) SIGRTMIN+237) SIGRTMIN+338) SIGRTMIN+439) SIGRTMIN+540) SIGRTMIN+641) SIGRTMIN+742) SIGRTMIN+843) SIGRTMIN+944) SIGRTMIN+1045) SIGRTMIN+1146) SIGRTMIN+1247) SIGRTMIN+1348) SIGRTMIN+1449) SIGRTMIN+1550) SIGRTMAX-1451) SIGRTMAX-1352) SIGRTMAX-1253) SIGRTMAX-1154) SIGRTMAX-1055) SIGRTMAX-956) SIGRTMAX-857) SIGRTMAX-758) SIGRTMAX-659) SIGRTMAX-560) SIGRTMAX-461) SIGRTMAX-362) SIGRTMAX-263) SIGRTMAX-164) SIGRTMAX
Kill all processes of a specified user:
kill -9 $(ps -ef | grep hnlinux) //Method 1: Filter hnlinux user processes kill -u hnlinux //Method 2
### Notes
* When using the `kill` command, you need to have the appropriate permissions; otherwise, you may not be able to terminate the process.
* Some processes may require multiple signals to be sent before they terminate, such as some daemons.
* Forcefully killing a process may lead to data loss or other side effects, so it should be used with caution.
[ Linux Command Manual](#)
YouTip