Is there a way to close a GUI application in friendly "please quit yourself now" way, without graphical access to the applications window?
For example, if Gnome/X display crashes to black, I'd like to switch to tty2 and close applications like firefox in a way which lets them save their config etc. At best without further user queries.
pkill
to specify the name of the executable instead. For example:pkill -HUP firefox-bin
– Caleb Aug 26 '11 at 15:13pkill
will kill them all. E.g., run this a few times to make some background processes:sed "s/Woo/woo/" < /dev/urandom >> /dev/null &
. Then dopkill -HUP sed
. You will kill all the instances of sed you started plus any other instances doing useful work. – ahcox Apr 07 '15 at 11:54pkill
will also kill some apps you don't expect to: e.g. if you havechromium
running, and want to kill a program calledrom
,pkill
will happily shootchromium
down. Better usekillall
, which will only match exact name (not on Solaris though, where it literally kills all processes). – Ruslan Jan 05 '18 at 15:53pkill -x
to get an exact match instead of a partial match. I personally take advantage of the partial matching to save typing, but you have to know what the tool does. Yes, by default it matches partial strings. Another useful option is-f
to match against the full command line instead of just$0
. – Caleb Jan 05 '18 at 15:57pid=$(ps -ae | grep rhythmbox | awk '{print $1}')
– Frank N Mar 26 '22 at 18:33