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. Commented Jan 26, 2017 at 18:33

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)
  • 3
    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. Commented May 22, 2014 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
    Commented May 22, 2014 at 15:40
  • 1
    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. Commented May 22, 2014 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
    Commented May 22, 2014 at 20:55
  • 1
    what about ctrl+q? That closes the active window (i guess with signal SIGTERM). On Windows is ctrl+w.
    – m3nda
    Commented May 22, 2015 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

  • thank you very much for this.
    – Azriel
    Commented May 11, 2022 at 3:28

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

  • As of 2023, that shortcut is Meta/Super + Ctrl + Esc in KDE. Commented Feb 11 at 23:43

You must log in to answer this question.

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