Created
December 20, 2020 00:36
-
-
Save cirrusUK/345df2f9bef0328286df548dc8fa7c35 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/bash | |
## uncomment lines 4-11 then add to zsh keybinds (default is ctrl+k) | |
#use fzf to kill proccesses | |
## fkill_widget() { | |
## sh $HOME/scripts/fkill # call fkill script locus | |
## zle reset-prompt | |
## } | |
## zle -N fzf-redraw-prompt # give me my $PS1 back | |
## zle -N fkill_widget | |
## bindkey '^k' fkill_widget #ctrl+k | |
################ fkill script start ########### | |
if [ "$UID" != "0" ] | |
then | |
pid=$(ps -f -u $UID | sed 1d | fzf -m --ansi --color fg:-1,bg:-1,hl:46,fg+:40,bg+:233,hl+:46 --color prompt:166,border:46 --height 30% --border=sharp --prompt="➤ " --pointer="➤ " --marker="➤ " | awk '{print $2}') | |
else | |
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') | |
fi | |
if [ "x$pid" != "x" ] | |
then | |
echo $pid | xargs kill -${1:-9} | |
fi | |
############## fkill script end ############# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment