Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the pkill command of linux to kill the process by its name

Shulou Source: shulou.com Published: 2022-06-02 18:59:27 09月22日 Update

Do not know how to use linux's pkill command to kill a process according to its name? In fact, it is not difficult to solve this problem. Let the editor take you to learn how to solve it. I hope you will gain a lot after reading this article.

The pkill command can kill a process by its name. Pkill and killall apply the same method, but also directly kill the running program. If you want to kill a single process, use kill to kill it.

Syntax format: pkill [parameters]

Common parameters:

-o send signal only to the smallest (start) process number found-n send signal only to the maximum (end) process number found-P specify parent process number send signal-g specify process group-t specify the terminal on which the process is started

Reference example

Send a signal only to the smallest (starting) process number found:

[root@linuxcool] # pkill-o

Send a signal only to the maximum (end) process number found:

[root@linuxcool ~] # pkill-n

Kill the Apache process:

[root@linuxcool ~] # pkill httpd Thank you for reading this article carefully. I hope it is helpful for everyone to share the pkill command of linux to kill the process according to the process name. At the same time, I also hope you can support it, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Tags: Processes signals commands maximum minimum parameters methods articles questions learning initiation almost content individual simultaneous examples commonly used formats programs terminals Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Tech Info Docker Linux Shulou Information