There are two primary ways to identify hung processes. One is via the System Monitor GUI and the other is via top
in command-line.
System Monitor
This can be found in System > Administration
You can also create a keyboard shortcut for this in this article.
Once the GUI launches you can select the Processes tab which will list all the running processes. Sort by the CPU column to find the most CPU intensive task
Lastly you can right click that task and choose to end it, stop it, or kill it. Killing it will immediately stop and remove that process from the system.
Command-Line
If you have a terminal open you can simply type top
this will list all the running processes similar to that of the Processes tab in the GUI
Within top it is CPU sorted by default - so the top most CPU intensive tasks are at the top. At anytime you can press the letter k to kill a process
Simply type the PID of the process you wish to kill and press enter. It will ask for a Kill signal to send. To kill the process nicely use the default 15 - to kill it right away "Do not pass go, do not collect $200" use 9.
The process will then be terminated.
If you are experiencing sluggish interface you can try to SSH in remotely if that is enabled - or switch to a virtual console via Ctrl+Alt+F# Where F#
is a Function Key (F3, F4, F5, etc). To return to the Desktop environment switch to either F7 or F8 depending on your version of Ubuntu.
There is no difference between the kill
command and the System Monitor's 'kill'. The System Monitor just gives some arguments to kill
that I assume you don't know.
When you kill <process-number>
, it's actually sending a signal to that process to cleanly exit. This is called a SIGTERM. In order to kill a process unconditionally, potentially causing data loss, you need to send a different signal:
kill -9 <process-number>
This sends a SIGKILL to the process, which immediately ends its execution. System Monitor uses kill -9
when you ask to 'kill' a process rather than simply 'close' it.
This answer on the SuperUser Stack Exchange should be of help.
Best Answer
Per the System Monitor manual, you should normally use "End Process", and only if that fails use "Kill Process":
On a technical level this makes me think that End Process sends a SIGQUIT, which allows the process to trap and perform cleanup if needed, but if that fails, Kill Process should send a SIGKILL which should violently terminate the process, without chance of recovery. Use sparingly!