Open In App

How to kill processes on the Linux Desktop with xkill

Improve
Improve
Like Article
Like
Save
Share
Report

xkill is a command-line utility that can kill the undesired windows on the user’s screen. Basically, xkill force the X server to close the connection to the client. This utility kills the programs without providing PID with a command. Now let’s see how to install the xkill on the systems.

Installation of xkill

The xkill utility comes with the package x11-utils. Therefore, to use xkill first we need to install the x11-utils on the system. Use one of the following commands to install x11-utils according to your distribution.

For Debian/Kali Linux/Garuda Linux/Ubuntu:

apt-get install x11-utils

For Arch Linux:

pacman -S xorg-xkill

For CentOS:

yum install xorg-xkill

For Fedora:

dnf install xorg-xkill

 

Using xkill command

For using xkill to kill the open window, just run the xkill command. Then your cursor will turn into an X sign. Then right-click on the windows which you have to kill.

xkill

 

Get a List of open windows

To get a list of all open windows that can be terminated using xkill command, run  the following command:

xlsclients

This command will show the list of all open windows with the hostname.

 

Exiting without killing windows

To exit from the xkill command without killing any window, press the ctrl+c key.

 

The ordinary way of killing process on Linux

Generally, when we want to kill any process on the Linux system, we use the kill command. To kill a process first we should know the PID of the respective process. Then we provide this PID to the kill command as the argument. We can find the PID of a process using the following command:

ps -A | grep -i processName

 

To kill the process, pass the PID to the kill command. For the above example:

kill 7507

There is a more simple way than passing the PID of the process to kill command to kill the process. pkill is a command using which we can kill the process using the name of the process. For the above example, we can kill gvim with pkill using the following command:

pkill gvim

pkill is an awesome command, but it is preferred to use the kill command to know more about the killing process.

Using xkill without using terminal

It is sounding weird to kill one process, we need to start another process. There is any way we can use xkill command without a terminal? yes, we can use xkill command without using the terminal. To access xkill command without using the terminal, we need to bind xkill command with the keyboard shortcut.

Let’s see how we can add xkill command to the keyboard shortcuts. We are going to see how we can bind keys in Gnome 3 desktop environment. Go to setting -> keyboard shortcut. Then you will see the following window:

 

Scroll down in the above setting window and right-click on the + button icon. After pressing the plus button, you will be prompted to input the command name and command and key binding on which this command should be launched. Enter the command name and command and keyboard shortcut which you like.

 

After entering the details, press add button. Now you can use the xkill command without using the terminal. Just press the shortcut you created.

Do xkill guarantee that closing its communication will kill/abort anything successfully?

xkill command does not give the guarantee that this command will successfully kill or abort the application. This command is simple, to close the connection of the application with the X server. Applications are indeed to terminate when their connection is closed with the X server, but some applications may continue after closing the connection with the X server.


Last Updated : 27 Jun, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads