How to Use the xkill command to kill Linux processes/unresponsive programs

Source: Internet
Author: User

How to Use the xkill command to kill Linux processes/unresponsive programs

How do we kill a resource/process in Linux? Obviously, we will find the resource pid and then use the kill command.

To better understand this, we can find the PID of a resource (such as terminal:

  1. $ ps -A | grep -i terminal
  2. 6228?00:00:00 gnome-terminal

In the above output, '1234568' is the pid of the process (gnome-terminal). Use the following command to kill the process.

  1. $ kill 6228

The kill command sends a signal to the pid process.

Another method is to use the pkill command, which can kill a process based on the process name or other attributes. We can also kill a process named terminal in this way:

  1. $ pkill terminal

Note: The pkill command is followed by a process name of no more than 15 characters.

Pkill seems easier to use, because you don't need to find the pid of the process. But if you want to better control the system, there is nothing to beat 'kill '. You can use the kill command to better examine the processes you want to kill.

We have an article covering the details of kill, pkill, and killall commands.

For those running X Server, there is another tool called xkill that can kill the process from X Window without passing its name or pid.

The xkill Tool forces X server to close the connection with its customer program. The result is that X resource closes the customer program. Xkill is an easy-to-use tool in the X11 tool set to kill useless windows.

For example, if you use the-display option to connect to the specified X Server with the display number when running multiple X servers at the same time, use-all (not recommended) kill all top-level windows on the screen and frame (-frame) parameters.

To list all client programs, you can run:

  1. $ xlsclients

 

Sample output
  1. ' '/usr/lib/libreoffice/program/soffice
  2. deb gnome-shell
  3. deb Docky
  4. deb google-chrome-stable
  5. deb soffice
  6. deb gnome-settings-daemon
  7. deb gnome-terminal-server

If the resource id is not followed, xkill will convert the mouse pointer into a special symbol, similar to "X ". You only need to click in the window you want to kill, it will kill its communication with the server, and this program will be killed.

  1. $ xkill

Use xkill to kill a process

It should be noted that xkill does not guarantee that its communication will be successfully killed/exited. Most programs will be killed after the communication with the server is closed. However, a small number of instances continue to run.

Note the following points:

  • This tool can only be used when the X11 server is running, because it is part of the X11 tool.
  • Do not get confused when you kill a resource and it is not completely exited.
  • This is not a substitute for kill.

Do I need to use xkill in the linux Command Line?

No, you do not have to run xkill in the command line. You can set a shortcut key and use it to call xkill.

The following describes how to set keyboard shortcuts in a typical gnome3 desktop.

Go to Settings> select the keyboard. Click '+' and add a name and command. Click the new entry and press the key combination you want. My options are Ctrl + Alt + Shift + x.

Gnome settings

Add shortcuts

The next time you want to kill an X resource, you only need to use the combination key (Ctrl + Alt + Shift + x). You can see that your mouse is changed to x. Click the x resource to be killed.

Via: http://www.tecmint.com/kill-processes-unresponsive-programs-in-ubuntu/

Author: Avishek Kumar Translator: geekpi Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.