Skip to content

Instantly share code, notes, and snippets.

@cirrusUK
Created December 20, 2020 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cirrusUK/345df2f9bef0328286df548dc8fa7c35 to your computer and use it in GitHub Desktop.
Save cirrusUK/345df2f9bef0328286df548dc8fa7c35 to your computer and use it in GitHub Desktop.
#!/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