Stop an application in linux

How to kill applications

I have been playing around with Ubuntu installing new themes and and docks. Sometimes during the installation, whole screen just hangs. What is the best way in Ubuntu to Kill a process/application? Anything similar to Ctrl + Alt + Del of windows?

You’ll want to be careful when killing installation processes. It can leave your machine in an inconsistent state. While this may not be such a big deal when installing customization packages, you’ll want to make sure that you’re not doing something akin to a kernel upgrade at the same time! (I’ve fragged an Ubuntu installation doing this)

10 Answers 10

Not quite like Ctrl Alt Del of Windows, but you can also kill with xkill . Just go to the «run» dialog ( Alt + F2 ), type in xkill and your mouse pointer will change to an «x». Point on the application that you want to kill and click, and it’ll be killed. Can sometimes be much quicker than loading the System Monitor.

Alt + F2 does not open the run dialog for me, but reduces sound volume. Using Ubuntu 18.04.1 on a Dell laptop.

In System->Admin you have an application called System Monitor, this is the equivalent of the windows task manager.

Edit: for later versions of Ubuntu (writing this on a PC running 13.10 ), you will find the system monitor through the dash (top left). Just type system monitor or parts of it in the dash and look for the System Monitor application..

alt text

I usually bind it to the CTRL+ESC combo as soon as I finish installing the SO. You can bind it to any combo using System->Preferences->Keyboard Shorcuts.

Have to install the System Monitor first. It was not installed by default when updating to Ubuntu 18.04.1 from 16.04.1 and switching to a Gnome desktop.

This is my personal list of killing:

  • kill example: kill 8888 effect: kill application that has PID 8888.
  • kill -9 example: kill -9 8888 effect: same with above but more extreme and forceful.
  • killall example killall firefox effect: kill application or application instance that has name firefox. You don’t have to know PID number, and this is my most favorite.
  • kill -9 -1 effect: kill all processes including X Server so you can go back to display manager (LightDM, GDM, or KDM). Another name for this command is relogin. And this command is a substution for clicking Log Out button.
  • Alt+Printscreen+REISUB effect: force restart; same with Ctrl+Alt+Del in Windows. It is very useful to avoid HDD damage.
  • Alt+Printscreen+REISUO effect: force shutdown, like Ctrl+Alt+Del but do shutdown instead of restart. Only differ 1 last char (O and B).
  • xkill effect: change your pointer to skull. If you click a GUI Windows with that, the Window will definitely be die.
Читайте также:  Change file names in linux

You can see PID of a process by commands ps aux , top , htop, or graphically by GNOME System Monitor.

Firstly you should know the PID of the application you want to kill.

you can use ps to get this.

ps aux | grep "$appName" | grep -v 'grep' 

Then use kill .(Ensure you have the privilege to kill it.)

If your screen hangs, you can switch to virtual console (Alt-Ctrl-F1), login with your user, type top, detect CPU eating process, and then run skill process_name. If it is system (root) process, use sudo skill process_name

Источник

How to Force Quit an App on Linux

How-to-force-Quit-an-app-on-Linux

Sometimes when the app is not responding, you cannot close it by clicking the normal close tabs. In such cases, you must force quit such applications.

Moreover, Linux is one operating system platform that gives multiple options for you to terminate the applications and system processes. Linux users can use the terminal, system monitor, and even add custom keyboard shortcuts, which makes it very convenient to force quit unresponsive apps.

In today’s article, we will go through different processes to force quit apps on Linux using different command lines and Graphical interface tools.

How to Force Quit an App on Linux?

There are different CLI and GUI-based methods to force kill an app on Linux. The easiest method to force quit an app is from the System monitor utility and the Xkill command. There are other advanced tools as well that you can use for this purpose. We will discuss them in detail in this article.

Force Quit an App on Linux With GUI

Some Linux distros like Ubuntu and Mint provide GUI applications to overview the system processes. These applications can be used to manage the system process and, additionally, to force quit the apps.

Using System Monitor App

In some distros that use GNOME Desktop Environment, a system process monitoring app is provided called System Monitor App, which is similar to Windows’s Task Manager. Users can force quit an app using this application.

  1. Go to Applications.
    applications
  2. Search for System Monitor and open it.
    System monitor
  3. In the Processes window, search for the Application you want to kill and right-click it.
  4. Select Kill or press Ctrl + K to force quit the app.
    kill-app

Note: If the system monitor app is not installed in the system, enter this command in the terminal to install it. sudo apt-get install gnome-system-monitor

Using Keyboard Shortcut

You can also set a certain keyboard shortcut to quit an app running in the system. There is a feature to add keyboard mapping to initiate this. Here is how you do it.

  1. Navigate to settings.
  2. From the left panel of the settings, go to Keyboard.
  3. Click on View and Customize Shortcuts.
    view-and-customize-shortcut
  4. Select Custom Shortcuts.
    custom-shortcut
  5. Click on AddShortcut.
    add-shortcut-on-linux

Custom Shortcut

  • In the Name field, assign it an appropriate name. And in the Command field, type xkill .
  • Now, click on the Set shortcut and press the desired shortcut key for the xkill to activate.

    Force quit an App on Linux With Commands

    You can use multiple command lines in Linux to manage the system processes. Additionally, some commands such as xkill , killall , and htop make it very easy to terminate the process in a go. We will go through some of these CLI tools you can use in Linux to force quit an app.

    Pidof command

    Before using the commands for the force stop, it is necessary to know about the process id. Each running process on Linux has an id you can use while terminating it. In order to determine the process id, you can use the pidof command. Use the syntax with the following format, along with its use case and output as shown in the screenshot.
    pidof

    If you are unaware of the exact process name, use the ps command to determine it.
    ps aux | grep -i

    ps command

    Using Xkill

    If you use the xkill feature, it will change the mouse cursor to X, which you can place over an application window and click on it to end its processes. Earlier, we mentioned a process to map the keyboard to activate the xkill command. However, you can also use this command from the terminal. Follow these steps to use it.

    Xkill command

    1. Press Ctrl + Alt + T to launch the terminal.
    2. Type xkill and hit enter. The mouse cursor will now change to X.
    3. Take the cursor over any point of the application window you want to force quit and click on it.
    4. Finally, the application process will stop in the system.

    Note: The xkill command is not installed by default on Linux and only works on Xorg sessions. You would have to install it using the package manager. Use this command to install it. sudo apt-get install xorg-xkill

    Using Kill command

    Kill command is a useful tool to terminate the system processes or applications running on Linux. The kill command uses the process id of the application and signals it to terminate the processes from the system.

    Sudo kill -9

    Here is the syntax for the command, along with its use case in the screenshot.
    sudo kill -9

    Sudo kill -9 with multiple process id

    If you have multiple processes to close, you can enter their process id into the single kill command line to force stop them at once. Here is the syntax for it.
    sudo kill -9 < processid3>

    Using Killall

    Killall command

    If you know the application’s process name, you can directly use the killall command to terminate the application from the system. Use this syntax for it.
    killall

    Using Htop

    htop is the command line that lets users monitor the terminal’s system processes and manage them. The latest alternative to the top command allows you to force quit the application and processes in the Linux OS quite efficiently. To use the htop command line, follow these steps;

    1. First of all, install the htop using the package manager if it isn’t already installed.
      sudo apt-get install htop sudo install apt htop
    1. Now, execute the command htop
    2. Select the process you want to stop the process.Htop command
    3. Then press F9. You will get options for sending the kill signals.
    4. Select SIGKILL and press enter. Signal kill in Linux

      Nishant is an enthusiast who loves writing about technology. He also is heavily invested in keeping himself updated about the latest happenings in the tech world. At Tech News Today, he covers Operating Systems, how-to-topics, and Fixes.

      Источник

      How to Stop a Program in Linux Terminal

      It’s amusing how the simplest of the things like stopping a running program could be overwhelming when you are new to the Linux command line.

      It’s amusing how the simplest of things could be complicated when you are new to something. The other day, I found my friend could not figure out how to exit the top command. Instead of stopping the command, he closed the entire terminal application. That’s not only unnecessary, but it is also a not good thing to do.

      Stopping programs in Linux

      stop a program linux terminal

      In Linux, you can use the Ctrl+C keys to stop a running program in the terminal. This works for Ubuntu as well as any other Linux distribution. Take the ping command for example. If you do not stop it, it will keep on displaying the result. Hold the Ctrl button and press the C key at the same time. It sends the SIGKILL signal to the running program to force quit the command. Do you see the ^C? The caret (^) means Ctrl. So basically, the terminal shows the Ctrl+C keystrokes as ^C. The Ctrl+C works very well for the commands designed to keep running until interrupted. You feel like you have to cancel the command, use Ctrl+C. You can find the process ID and kill a running process in a more complicated method. That’s more advanced stuff and used only when the process is running in the background or by another user or in another terminal window. Apart from that, some other commands and command line tools have their own exit commands. Let me briefly mention some of them here.

      How to exit Vim editor

      How to exit Vim editor in Linux

      Existing Vim editor has made so many jokes in the Linux world. It is difficult to figure out when you are new to this powerful command line based text editor. Among several ways of quitting vim, the most common is to press the Esc key and then type a colon (:) and then type q! for force quit without save or wq for save and quit.

      How to exit Nano editor

      Save and Exit Nano editor

      Quitting the Nano editor is a bit simpler than exiting Vim. Why? Because Nano mentions the shortcut at the bottom. You may not understand it if you are new to it but at least you’ll be able to figure it out the next time. To exit Nano, press Ctrl+X. It will ask if you want to save the changes made to the file or not. You can enter your choice.

      How to exit less command

      The less is an excellent command that lets you view without cluttering your terminal screen like the cat command. If you are inside the less command view, use the key q to exit less.

      How to exit the terminal

      To exit the terminal itself, instead of closing the terminal, either use Ctrl+D keyboard shortcut or type the exit command:

      This actually exists you from the current shell. When you open a terminal in Ubuntu or any other Linux distribution, it runs the default shell. When you exit from this shell, terminal ends as well. Ctrl+D is the shortcut to do the same and quit the terminal. I hope you find this quick tutorial helpful. I highly recommend learning these Linux command tips.

      Источник

  • Оцените статью
    Adblock
    detector