In Ubuntu Linux, you can use the kill
command to terminate a process. The kill
command sends a signal to a process, which terminates the process. By default, the kill
command sends the SIGTERM
signal, which asks the process to gracefully terminate.
Here’s an example of how to use the kill
command to terminate a process:
- Find the PID (process ID) of the process you want to kill. You can use the
ps
command to list all running processes and their PIDs:
ps aux | grep process-name
Replace process-name
with the name of the process you’re looking for.
- Use the following command to send the
SIGTERM
signal to the process:
kill PID
Replace PID
with the actual PID of the process you found in step 1.
If the process does not respond to the SIGTERM
signal, you can use the SIGKILL
signal, which forces the process to terminate immediately. The SIGKILL
signal can be sent using the following command:
kill -9 PID
Note that the SIGKILL
signal cannot be ignored or caught by the process, so use it with caution.