LinuxCommandLibrary

xkill

Forcefully terminate a graphical program (X client)

TLDR

Display a cursor to kill a window when pressing the left mouse button (press any other mouse button to cancel)

$ xkill
copy

Display a cursor to select a window to kill by pressing any mouse button
$ xkill -button any
copy

Kill a window with a specific ID (use xwininfo to get info about windows)
$ xkill -id [id]
copy

SYNOPSIS

xkill [-display displayname] [-id resource] [-event event-number] [-button button-number]

PARAMETERS

-display displayname
    Connects to the specified X display instead of $DISPLAY.

-id resource
    Kills the client with the exact window resource ID (hex or decimal).

-event event-number
    Listens for custom X event (default: ButtonPress, event 4).

-button button-number
    Triggers on specified mouse button (default: 1).

DESCRIPTION

xkill is a powerful X Window System utility designed to forcibly terminate misbehaving or frozen client applications. Upon invocation without options, the cursor transforms into a skull-and-crossbones icon, signaling that clicking on any window will send a KillClient request to the X server, abruptly ending the selected client regardless of its state.

This tool shines in scenarios where graphical apps hang, ignoring close buttons or keyboard shortcuts. It's a quick recovery method in X11-based desktops like those using Openbox, i3, or even GNOME/KDE under Xorg.

However, precision is crucial: accidental clicks can destroy your window manager, panel, terminal, or compositor, potentially stranding you in a bare X session. Always prepare a virtual console (e.g., Ctrl+Alt+F3) beforehand.

Advanced modes allow non-interactive use via resource IDs (obtained from xwininfo) or custom mouse events/buttons, enabling scripted automation or remote debugging. Despite its age, xkill remains indispensable for X11 users facing uncooperative windows.

CAVEATS

Dangerous tool: Can kill window manager, shell, or desktop. Test in VM first. Cancel interactive mode with Delete or Esc. Use -id for safety. Ineffective on Wayland.

INTERACTIVE CANCEL

In cursor mode, hit Delete or Esc to abort without killing.

GET WINDOW ID

Run xwininfo -tree -root or xprop | grep -i '^_net_wm_name' then select for ID.

HISTORY

Developed by the MIT X Consortium; debuted in X11 Release 4 (1989) as a core debugging aid. Maintained in xorg-x11-apps; unchanged core functionality across decades.

SEE ALSO

xwininfo(1), xprop(1), wmctrl(1), xdotool(1)

Copied to clipboard