diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-05-10 22:57:02 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-05-10 22:57:02 +0200 |
| commit | 3cd9138c9d8fb9be248c75330cca9da47f4d2e8a (patch) | |
| tree | b3b677a9c1a474589f45d20953028a987fa73b80 /fkill | |
| parent | 83f7fe4b8402bab171d110703a1b1115efbc9b28 (diff) | |
| download | bin-3cd9138c9d8fb9be248c75330cca9da47f4d2e8a.tar.gz bin-3cd9138c9d8fb9be248c75330cca9da47f4d2e8a.zip | |
added a whole bunch of scripts
Diffstat (limited to 'fkill')
| -rwxr-xr-x | fkill | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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" |
