How To Quit Frozen Programs In Linux
So many different ways to kill a process
Even a robust operating system like Linux can sometimes encounter problems that cause apps or programs to freeze.
There are several ways to kill or quit a frozen program on Linux. This article will explain how.
Use The Kill Command
Before you can use the kill command, your system needs to know the Process ID (PID) of the unresponsive program.
PID is a number that automatically identifies each process when created on any Linux OS. An advantage of this method is that it works on all Linux systems.
If you don’t know which process is frozen on Linux, two tools will help you find the process:topandps.
Topis a command line-based system monitor. From the command line, type the following:
$ top
The screenshot above shows a lot of information. For example, let’s say Chrome is the frozen program on your computer.
You can see that there are four instances of Chrome that are running with the following PIDs:
To identify the specific instance of Chrome you want to kill, use thepscommand andgrepto filter the output.
The command below will show you the running processes associated with Chrome:
ps aux | grep chrome
Kill The Process
You now have the two pieces of information needed to kill a frozen process on Linux: its name and ID. Use the commands below:
There are other signals you can send to both commands, depending upon the results you want.
As an example, if you want to kill the unresponsive process and then restart it, you will use theHUP(hang up) signal.
Other kill signals include:
We learned from thepscommand above that the PIDs for the instances of Chrome are 3827, 3919, 10764, and 11679.
To send the kill signal, run the following commands to kill all four instances of Chrome successfully:
You can also use the single command below usingkillallto send the same signal:
killall -9 chrome
Click The X
Unresponsive programs and apps typically have grayed-out buttons or options that don’t work. Sometimes you can’t even move the app window around the screen.
The easiest solution is to click theXbutton in the top corner. Depending upon your OS, the button may be on the left or on the right top corner.
After clicking theX, you will see a dialog box with two options:WaitorForce Quit. To end the program, clickForce Quit.
Kill a Linux Process on Linux Using System Monitor
The default System monitor in Ubuntu is called Gnome. It gives insights into all the processes running on Ubuntu Linux operating systems.
Users can perform various tasks using the Graphical User Interface (GUI), includingStop,Continue, andKill.
If your system doesn’t include the Gnome system monitor app, install it by following the steps below. This process works for all active versions of Ubuntu Linux as well as Linux Mint and Debian.
sudo apt-get install gnome-system-monitor
gnome-system-monitor
You will see several options, including:
Use The xkill Command
Xkill is a pre-installed Ubuntu kill utility that you can use to force kill an unresponsive Linux process. It is a tool that comes pre-installed in Ubuntu.
You can also install it via the Terminal on other distributions by using the following command:
sudo apt install xorg-xkill
Then run it by typingxkill. Your mouse will turn into a skull or anx. Left-click on the frozen program to close it.
Use pgrep & pkill
Several Linux systems offer shortcuts calledpkillandpgrepfor performing the same tasks askillandpsdiscussed above.
Pgrepwill show the process name and ID. For example, runningpgrep chrometo see the process ID of the running Chrome process. You can then use that ID with the kill command.
pkill 7012
Or, you can skip this step and use the command below to kill all instances of Chrome:
pkill chrome
This solution works well if you only have one instance of an application running. However, if you have several windows open of the same program and only want to kill one, useXKillinstead.
When a program hangs, restarting your system is not always the most convenient option. This is especially true if you are working on several projects at the same time and have not saved your work.
Try one of the options above as an alternative to easily and quickly exit frozen or non-responsive programs on Linux safely.
David has a background in small business and lives in Australia. He is a WordPress and Ubuntu Developer who enjoys design, CSS and tech tool integration.Read David’s Full Bio
Leave a Reply
Your email address will not be published.Required fields are marked*
Comment*
Name*
Email*
Website
Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.
HomeAbout UsEditorial StandardsContact UsTerms of Use
Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved