From 3cd9138c9d8fb9be248c75330cca9da47f4d2e8a Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Sun, 10 May 2026 22:57:02 +0200 Subject: added a whole bunch of scripts --- fkill | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 fkill (limited to 'fkill') diff --git a/fkill b/fkill new file mode 100755 index 0000000..83ee9b5 --- /dev/null +++ b/fkill @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Pick processes via fzf, kill them. Default SIGTERM, override with first arg. +# Usage: fkill # SIGTERM +# fkill KILL # SIGKILL +# fkill 9 # SIGKILL (numeric) +set -eu + +sig="${1:-TERM}" + +pids=$( + { printf '%-7s %-10s %5s %5s %10s %s\n' PID USER %CPU %MEM ELAPSED COMMAND + ps -eo pid,user,pcpu,pmem,etime,args --sort=-pcpu --no-headers \ + | awk -v me=$$ -v ppid=$PPID '$1 != me && $1 != ppid' + } \ + | fzf --multi --header-lines=1 \ + --header='TAB multi-select, Enter to kill' \ + --preview='echo {}' --preview-window=down:3:wrap \ + | awk '{print $1}' +) + +[[ -z "$pids" ]] && exit 0 +echo "$pids" | xargs -r kill -"$sig" -- cgit v1.3