-
-
Save nuryslyrt/c606e067938d98f6415195fd6a3e9644 to your computer and use it in GitHub Desktop.
Kill a procees with pid getting on the fly via awk
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
#For example, we want to kill Netbeans | |
ps -ef | grep beans | awk ' $6 != "ttys000" {print$2;}' | xargs kill {} | |
#Or get the first line only (to aovid getting grep command itself) | |
ps -ef | grep beans | head -n 1 | awk ' {print$2}' | xargs kill {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment