Created
April 22, 2015 09:03
-
-
Save leemour/40e6e9dc1c81b9c2df95 to your computer and use it in GitHub Desktop.
Kill process Ubuntu by name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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