I just opened more than a hundred persistent graphing windows using gnuplot -persist with x11 on a RHEL desktop. Is there any easy way to close them all? I don't really want to logout/in or click through them manually.


1 Answer 1


To kill all Gnuplot processes:

pkill -x gnuplot

If you want to kill just the Gnuplot processes that were invoked with the -persist option:

pkill -fx 'gnuplot -persist.*'

If you want to close the windows without closing the Gnuplot processes (I think that's useless here because closing the windows causes the Gnuplot processes to exit), you can use wmctrl: wmctrl -c gnuplot closes all Gnuplot windows (more precisely, it sends a WM_DELETE_WINDOW message to all windows whose title contains gnuplot, which is the same as clicking the “close” button on all these windows). If you want to close only some of the Gnuplot windows, you can parse the output of wmctrl -l to find the window IDs that you want and close the windows with wmctrl -c or xkill -id.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .