I've been running some Python scripts to graph some stuff and occasionally I'll lose track of what windows it spawned and just kill it with ^Z. However, unlike in Windows, the associated windows don't die; they stick around and cannot be closed.

These windows seem clueless; they don't redraw after being minimized or resized. I'm new to the Linux env so I can't fully articulate what's going on, but in any event, how do I get rid of these zombie-orphan-hobo windows?

  • Assuming that you run these scripts from a terminal, you can always type exit and the process(es) should quit automatically (at least with my experience). Also, you can use the ps -A command and then type sudo kill <process id here>. – Alex Spataru Apr 8 '13 at 22:28
  • 1
    ^Z doesn't kill a Linux process. It just suspends it. ^C should be your first choice. When you have to resort to ^Z to regain control of the terminal, you should kill the suspended job, to free up the resources it's still using. It won't die with any signal other than SIGKILL while it's suspended. "bg" will thus be useful to let the child die. xkill's nice and easy to use but it doesn't actually kill the process either. A well-behaved program, one that isn't stuck eg because it's been suspended, will exit when its X connection is closed by xkill. – Martin Dorey Mar 29 '17 at 18:50

You can use xkill in the command line, which allows you to click an open window to kill the process.

  • 3
    Even better if you run it from Alt-F2 so that you don't need a terminal window. – colan Jun 26 '14 at 1:08
  • Very nice, very nice – Sajad Torkamani Feb 12 at 14:10

You can also use the sequence Ctrl+Alt+Esc

  • By default it is set to Switch system controls directly at least in my system and one installed in VMWare(both are 18.04 LTS). You might like to add how to redefine that shortcut. – Kulfy Sep 28 '18 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.