Restart audio (Fedora)
systemctl --user restart pipewire
Kill a process and its descendants
kill -- $(ps -o 'pgid=' -p "$(pgrep -f 'PROGRAM TITLE' | xargs)" | uniq | xargs -IX echo -X | xargs)
$(pgrep -f 'PROGRAM TITLE' | xargs)
- Get
PID
of processes you want to kill based on a match against the full title of the program - Use
xargs
to convert multi-line input to a single line
- Get
$(ps -o 'pgid=' -p "123 456 789" | uniq | xargs -IX echo -X | xargs)
ps -o 'pgid=' -p ...
prints out thePGID
(Process group ID) without any headingspgid=
of the process IDs123
,456
, and789
uniq
removes duplicate lines from the outputxargs -IX echo -X
Prefix eachPGID
with a-
-IX
tellsxargs
to replace letterX
with a value from the input.-NUMBER
tokill
,ps
and friends, means to match processes against thePGID
as opposed to thePID
xargs
changes the multi-line output to be a single line, space separated
kill -- -998 -991
--
Tells kill that all option arguments have ended (so that it does not confuse-998
with a signal such as-9
(-SIGKILL
)