how to use pkill command with its examples

The pkill command allows you to send signals to processes based on their names or other attributes. Which is commonly used to terminate or signal processes without having to know their exact process IDs (PIDs).

  • About pkill: To send the specified signal to process
  • Comes From: procps-3.2.8
  • Configuration Files:
  • Path: /usr/bin/pkill

Examples:

1. To send the signal to a process

$ pkill -9 -P 2210

 2. To only match processes in the process group IDs listed

$ pkill -9 -g 502 

3. To only match processes whose real group ID is listed

$ pkill -G

 4. To Select only the newest

$ pkill -n

 5. To Select only the oldest

$ pkill -o

 6. To Only match processes whose parent process ID is listed

$ pkill -P 2210 

7. To only  match processes whose process session ID is listed

$ pkill -s

  8. To only match processes whose controlling terminal is listed

$ pkill -t term

 9. To only  match processes whose effective user ID is listed

$ pkill -u euid 

10. To only match processes whose real user ID is listed

$ pkill -U uid

 11. To negate the matching

$ pkill -v 

 12. To only match processes whose name

$ pkill -x 

 13. To Defines  the  signal  to  send to each matched process

$ pkill -signal

Leave a Reply

Your email address will not be published. Required fields are marked *