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.

  • On certain KDE applications in Linux, Ctrl+w closes the current focused window. – Eric Leschinski Jan 26 '17 at 18:33

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)
  • 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
  • 1
    what about ctrl+q? That closes the active window (i guess with signal SIGTERM). On Windows is ctrl+w. – erm3nda May 22 '15 at 8:35

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


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

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.