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

Posted on in Categories , , , , last updated June 3, 2014

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 "[email protected]: ~"
 
  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:

0x6e4c0a7

Finally, run xkill command as follows:

xkill -id 0x6e4c0a7

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 3 comments/add one below):

3 comment

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

Comments are closed.