pkill is a command-line utility that sends signals to the processes of a running program based on given criteria. The processes can be specified by their full or partial names, a user running the process, or other attributes.
The pkill command is a part of the procps (or procps-ng) package, which is pre-installed on nearly all Linux distributions.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux System queries.
In this context, we shall look into how to use the pkill command in Linux.
You can list all running processes on your Ubuntu machine by running the following command:
To stop, simply Press Ctrl + C.
The syntax for pkill command is:
$ pkill [option] pattern
Pattern here Invokes an extended regular expression that matches a process or command-line name.
If you use pkill command-line without [option], 15 (-TERM) signal will be sent by pkill to the PID. (Process ID).
Linux users usually use the three types of signals as below:
$ pkill -9 chrome
The above command will close the chrome browser.
kill -l is used to list all the signals you can use.
There are 3 different ways to specify the signals:
For demonstration, in order to kill the oldest created screen:
$ pkill -9 -o screen
To reload the gitlab-runner process, run:
$ sudo pkill -HUB gitlab-runner
This article covers how to use the pkill command in Linux. pkill is basicity a wrapper around the pgrep program that only prints a list of matching processes.
The syntax for the pkill command is as follows:
$ pkill [OPTIONS] <PATTERN>
The matching <PATTERN> is specified using extended regular expressions.
For more information about pkill command, visit the pkill man page or type man pkill in your terminal.
Other Linux commands: