pkill
Signal processes based on name and other attributes
Overview
pkill sends signals to processes based on their name and other attributes, such as user ID or full command line. By default, it sends the SIGTERM signal.
Syntax
pkill [OPTION]... PATTERNCommon Options
-signal, --signal signalSpecify the signal to send (name or number, e.g., -9 or -KILL). Defaults to SIGTERM.
-f, --fullThe pattern is normally only matched against the process name. When -f is set, the full command line is used.
-x, --exactOnly match processes whose name (or command line if -f is used) is exactly the pattern.
-u euid, --euid euidOnly match processes whose effective user ID is euid.
-U uid, --uid uidOnly match processes whose real user ID is uid.
-G gid, --Ggid gidOnly match processes whose real group ID is gid.
--older-than secondsMatch only processes older than the specified time in seconds.
--newer-than secondsMatch only processes newer than the specified time in seconds.
-c, --countCount the number of matching processes and display the count instead of killing them.
-l, --list-nameList the name of the process along with the PID (does not kill).
-n, --newestSelect only the newest of the matching processes to signal.
-o, --oldestSelect only the oldest of the matching processes to signal.
-i, --ignore-caseIgnore case distinctions in pattern.
Examples
Sends SIGTERM to all processes named firefox.
Sends SIGKILL to all processes whose full command line contains defunct_script.sh.
Sends SIGTERM to all java processes owned by username.
Sends SIGTERM only to processes exactly named very_specific_daemon.
Sends SIGTERM to processes whose command line contains "my application", ignoring case.
Sends SIGTERM to the oldest running process whose command line matches "backup_job".
Counts the number of processes named "defunct" without sending a signal.
Sends SIGTERM to the newest process whose name matches "my_process", ignoring case.