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.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements / xkill
Est. reading time N/A

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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • sentsent Jul 4, 2012 @ 6:55

    this command is cool!!!

  • Alex Muraro Nov 6, 2012 @ 11:01

    best command ever :)

  • Eric May 22, 2014 @ 13:40

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

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum