52

In Windows by using Task Manager we can see how many .exe files are running. Also in command prompt we use tasklist command to see processes. In ubuntu how can I see all processes and kill unwanted processes?

5 Answers 5

50

From the terminal, ps -ef will list all the processes. See man ps. See man kill, man 2 kill, man killall, man nice, man pkill, man renice, man 7 signal, and man skill to mess with processes. However, simply killing a process that you think is useless may be a mistake. The system might restart the process, or something you depend on might depend on the process you killed. Learn what the processes do, and look at /etc/init/ and /etc/init.d, /etc/rc?.d, man service to see how processes are started by the system.

1
  • 2
    You didnt answer how to kill. kill -9 <pid> Feb 11, 2020 at 15:38
24

Using GUI, you can use System Monitor

enter image description here

Or from terminal you can use

ps aux | less

To view every process:

ps -A or ps -e

All processes running by a user:

ps -u username

To kill a process, either find the process name and type:

kill -9 processname

or kill the process ID (PID):

kill pid

Stop/suspend a process:

ctrl-z

Source:Man Page

2
  • 1
    can you plz explain how to via terminal with details? Jun 13, 2015 at 20:25
  • I just added more info in my answer. Let me know if you need more info.
    – Mitch
    Jun 14, 2015 at 5:58
8

There is also the tool "htop". It is like "top", but has lots of other capabilities.

In a terminal enter:

sudo apt install htop
5

My main tool here is top

type top at the command line in a terminal window

You'll get a list of the process that are running, listed by cpu usage. Wait a few seconds for it to gather more stats before proceeding.

enter image description here

This is my main tool in unix for killing runaway or unwanted processes. They are likely to be near the top of the list. Note their pid and press q and then either 15 (soft kill) or 9 (hard kill).

Here you see me killing a Chrome process:

enter image description here

enter image description here

The process should go away. Then type q to quit out of top.

If you find you are always killing the same processes you can also use kill or killall at the command line, for instance if top has shown several java programs taking up cpu you can quit out of top and do killall java
kill and killall use 15 (SIGTERM) by default but you can override this with killall -9 [process] or killall -s SIGKILL [process]

1

Another good tool to use will be Glances.

Glances screenshot

1
  • Welcome to Ask Ubuntu! I recommend to edit this answer to expand it with specific details about how to use this to perform the task in question, i. e. kill unwanted processes. It's not entirely obvious to me. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) Mar 22, 2018 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.