From 52d87e2329eaa5f56a1f0bad3913bd5820537f53 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 19 Mar 2024 23:14:56 +0200 Subject: Add kill-process script --- kill-process | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 kill-process (limited to 'kill-process') diff --git a/kill-process b/kill-process new file mode 100755 index 0000000..5247e5f --- /dev/null +++ b/kill-process @@ -0,0 +1,6 @@ +#!/bin/sh +# pipes list of processes into rofi/dmenu and kills the selection + +proc=$(ps -u $USER -o pid,%mem,%cpu,comm | sort -b -k2 -r | sed -n '1!p' | dmenu -i -p "Kill" | awk '{print $1,$4}') + +[ -z "$proc" ] || (kill -15 $(echo $proc | awk '{print $1}') 2>/dev/null && notify-send "$(echo $proc | awk '{print $2}') killed") -- cgit v1.2.3