Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I kill the currently active window with a command or keyboard shortcut?

Alt+F4 closes a window, but first it will wait for the program to respond. Depending on the application, this may take several minutes. I am specifically interested in a solution with no waiting period -- that is, a solution that takes effect instantly.

I want to immediately kill the currently focused window with a shortcut.

share|improve this question

3 Answers 3

I think you are looking for xkill.

Start it in a shell, then click on the offending window.

Alternatively, you can do Alt-F4 and wait - then you will be asked

the program is not responding - terminate it? (you will lose unsaved work)
share|improve this answer
    
Thanks for the answer! I would prefer to use a keyboard shortcut instead of opening a shell, typing a command, and then using my mouse to find the window. When I open a shell, it might overlap or hide the offending window. I think it's much easier to use a shortcut. –  Kamil Slowikowski May 22 '14 at 15:33
    
In that case you should use Alt-F4 or click on the "x" in the upper right(or left) corner. After a while, you will be asked the "terminate it?" question. –  sds May 22 '14 at 15:40
    
In theory, you're right. In practice, I don't have time to wait for the application to respond. Sometimes it takes minutes before such a "terminate it?" question pops up. After clicking "terminate it" then I have to wait even longer. I'm looking specifically for a solution that avoids waiting. –  Kamil Slowikowski May 22 '14 at 20:25
    
It is far too easy to "mis-click", so such a dangerous action as killing an application will never be easy. –  sds May 22 '14 at 20:55
up vote 2 down vote accepted

Use xdotool to kill the currently active window:

xdotool getwindowfocus windowkill

On Ubuntu, make a keyboard shortcut:

  1. Open Keyboard settings (shown below).
  2. Create a shortcut with the command: xdotool getwindowfocus windowkill

I chose: Ctrl+Alt+x

This shortcut will kill the currently active window immediately. It will not wait for the application to respond, terminate, save, close files, finish up, etc.

Keyboard Settings

share|improve this answer

The default kill-window shortcut for me in KDE is Ctrl+Alt+Esc

enter image description here

(There's a separate Alt+F4 "close window" entry)

System Settings -> Shortcuts and Gestures -> Global Keyboard Shortcuts -> KWin

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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