How do I kill processes in Ubuntu?

Solution 1:

To kill all the processes that you have the permission to kill, simply run the command

kill -15 -1 or kill -9 -1 depending on the desired behavior (use man kill for details)

To kill a specific process, say, firefox, simply run

pkill firefox or killall firefox depending on the behavior you want: What's the difference between 'killall' and 'pkill'?

If you want to see what processes are running use the command

ps -ef

If you want to look up all processes by user bob, this might help

pgrep -l -u bob

or

ps -ef | grep bob

Solution 2:

Use sudo kill <pid> or sudo killall <process-name>

Solution 3:

You can use

ps -ax | grep application name 

If your searching for firefox type in terminal like ps -ax | grep firefox, it shows the process id of corresponding application. You can stop that application by kill command if process id=1317,

kill -9 1317

Solution 4:

Let's try something more:

sudo apt-get install htop 

The top command is the traditional way to view your system’s resource usage and see the processes that are taking up the most system resources. Top displays a list of processes, with the ones using the most CPU at the top.

htop displays the same information with an easier-to-understand layout. It also lets you select processes with the arrow keys and perform actions, such as killing them or changing their priority, with the F keys.

Solution 5:

I would use xkill. Enter xkill in a terminal and click in the window, or enter xkill and the process ID and it will be terminated.

Found out more about xkill on x.org.