bash pkill kill - ghdrako/doc_snipets GitHub Wiki

kill all Nginx Processes - Remember to keep first letter in bracket !!!

kill $(ps aux | grep '[n]ginx' | awk '{print $2}')
pkill swiftfox  #  zabije w tym przypadku wszystkie procesy pasujące do wyszukiwanego tekstu swiftfox

pgrep -l swiftfox # lista procesow ktore zabilby pkill

pkill '^ssh$'

pkill -9 -f "ping 8.8.8.8"  # -f option is used, the command matches against full argument lists. If the command contains spaces, quote the entire command


pkill -u mark #  -u option to tell pkill to match processes being run by a given user

pkill -u mark,danny # kill proces multiple users

pkill -9 -u mark gnome # kill proces user mark contain  gnome in name


pkill -9 -n screen  # to kill the most recently created screen 

Use the kill -l command to list all available signals.

The most commonly used signals are:

  • 1 (HUP): to reload a process.
  • 9 (KILL): to kill a process.
  • 15 (TERM): to gracefully stop a process.

Signals can be specified in three different ways:

  • using a number (e.g., -1)
  • with the “SIG” prefix (e.g., -SIGHUP)
  • without the “SIG” prefix (e.g., -HUP)