Skip to content

Instantly share code, notes, and snippets.

@leemour
Created April 22, 2015 09:03
Show Gist options
  • Save leemour/40e6e9dc1c81b9c2df95 to your computer and use it in GitHub Desktop.
Save leemour/40e6e9dc1c81b9c2df95 to your computer and use it in GitHub Desktop.
Kill process Ubuntu by name
kill $(ps aux | grep 'puma' | awk '{print $2}')
# The ps gives you the list of all the processes.
# The grep filters that based on your search string, [p] is a trick to stop you picking up the actual grep process itself.
# The awk just gives you the second field of each line, which is the PID.
# The $(x) construct means to execute x then take its output and put it on the command line. The output of that ps pipeline inside # that construct above is the list of process IDs so you end up with a command like kill 1234 1122 7654
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment