Linux / UNIX: Kill Command Examples

Linux / UNIX: Kill Command Examples

The kill command is a useful tool for terminating processes in Unix. Here are a few examples of how you can use the kill command:

  • To terminate a process with a specific process ID, you can use the kill command followed by the process ID. For example, to terminate the process with process ID 12345, you can use the following command:
kill 12345
Source‮www:‬.lautturi.com

This will send a termination signal to the process with process ID 12345, causing it to terminate.

  • To terminate a process with a specific process name, you can use the killall command followed by the process name. For example, to terminate all processes with the name chrome, you can use the following command:
killall chrome

This will send a termination signal to all processes with the name chrome, causing them to terminate.

  • To send a specific signal to a process, you can use the -s option followed by the signal name or number. For example, to send the SIGSTOP signal (number 19) to the process with process ID 12345, you can use the following command:
kill -s 19 12345

This will send the SIGSTOP signal to the process, causing it to be stopped (but not terminated).

Overall, the kill and killall commands are useful tools for terminating and controlling processes in Unix. They have many other options and features that allow you to customize their behavior and target specific processes.

Created Time:2017-10-29 22:08:56  Author:lautturi