≡ Menu

HowTo: Linux / Unix Kill X Window Halted, Frozen or Resource Eating Application

How do I kill X Window system application that is eating system resources and can not killed from local or remote X sever?

You need to use xkill command. It kills a client by its X resource and not by process ID. For example, your application may not be responding kill request. Even if you try to kill you see application window.

The xkill is a utility for forcing the X server to close connections to clients. This program is very dangerous, but is useful for aborting programs that have displayed undesired windows on a user’s screen.

Open a terminal type the following command:
$ xkill

By default xkill will display a special cursor with which you should select a window to be kill. Click on the application which you want to abort forcefully or select the X window / application whose client you wish to kill with button 1. If a pointer button is pressed over a non-root window, the server will close its connection to the client that created the window.

How do I kill the application using the X identifier?

An easy way to find out the id of a window, is running a command like:
$ xwininfo
You need to select target window with the mouse to get information about windows. Here, is a sample output from my gnome-terminal window:

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.
xwininfo: Window id: 0x6e4c0a7 "vivek@wks01: ~"
  Absolute upper-left X:  2443
  Absolute upper-left Y:  231
  Relative upper-left X:  2443
  Relative upper-left Y:  231
  Width: 983
  Height: 636
  Depth: 32
  Visual: 0x104
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x6e00003 (not installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +2443+231  -414+231  -414-333  +2443-333
  -geometry 80x24+2443+231

Note down the window id # 0x6e4c0a7. You can also use the following syntax to get window id:

xwininfo | awk '/Window id:/ {print $4}'

Sample outputs:


Finally, run xkill command as follows:

xkill -id 0x6e4c0a7
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 3 comments… add one }
  • sentsent July 4, 2012, 6:55 am

    this command is cool!!!

  • Alex Muraro November 6, 2012, 11:01 am

    best command ever :)

  • Eric May 22, 2014, 1:40 pm

    Thanks you, xwininfo was useful indentifying a Chrome ghost window and killing it to recuperate an area of my desktop.

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , ,