Created
July 4, 2021 17:28
-
-
Save agilesteel/7a3431388ad65e8fa032526f8548f14b to your computer and use it in GitHub Desktop.
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
alias jps ='jps -lvm' | |
alias jpsk9='jps | fzf --reverse -m -e -i | cut -d " " -f1 | xargs kill -9 2>/dev/null' | |
alias jpsk ='jps | fzf --reverse -m -e -i | cut -d " " -f1 | xargs kill 2>/dev/null' |
I also just learned about it a few weeks ago :)
i like it
I've based a version of this, it includes the working directory (which is useful for distinguishing sbt processes running in the background):
jpsk() {
jps -l | awk '{
# run pwdx for the first column, write the output to `wd`
cmd = "pwdx "$1
cmd | getline wd
close(cmd)
# pwdx prefixes the working directory with a pid, like "1234: /home/john", we remove it (modifying `wd` in-place)
sub("[0-9]+: ", "", wd)
# then append wd to the jps output
print $0 " [" wd "]"
}' | fzf --reverse -m -e -i | cut -d " " -f1 | xargs kill 2>/dev/null
}
Fancy 😉
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I didn't know about jps and this is awesome <3