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.
Related videos on Youtube
djangofan
Updated on September 18, 2022Comments
-
djangofan over 1 year
How do I kill all processes running by my own non-root account?
I have some spinning smbd processes that I caused from my windows machine and so I telnetted into the linux server and I want to kill those spinning processes. I don't have authority to restart services or reboot the machine.
-
Simon Richter about 12 yearsI'd start with
kill -15 -1
, and only move on tokill -9 -1
if there are stubborn processes and I know what I'm doing. Randomly killing processes that may be in the middle of a database transaction is not something one should do as casually as you suggest. -
Simon Richter about 12 yearsAlso, Firefox's process is named
firefox-bin
. -
ste_kwr about 12 yearsNo, you can try running
killall firefox
andkillall firefox-bin
and see what works. I agree with your first comment. -
pl1nk almost 12 yearsI don't think this is relevant to this question, you are using sudo -- the OP has not such privileges, as mentioned in the question.
-
ish almost 12 yearsThe OP doesn't have privileges, please edit your answer or it may be deleted or converted into a comment as "not an answer".
-
Sergiy Kolodyazhnyy about 9 yearsUse it second in frequency after pkill nd love it. +1
-
PythoNic over 8 yearsxkill doesnt work in this case...
-
Alvar over 8 years@PythoNic in what case is that?
-
PythoNic over 8 yearsHe wants to kill a non-window process which is also not related to the X server as it seems for me... (Anyway a good tool.)
-
Java.beginner over 8 yearsThanks @ste_kwr, worked with your instructions, after struggling for two days...
-
muru over 8 yearsYou could have dropped the
-l
, and ranpgrep -u justin skype
, and to kill:pkill -u justin skype
(orpkill -KILL -u justin skype
to send SIGKILL). -
Shailyn Ortiz over 6 yearsIf he doesn't have privileges he just have to do kill <pid> or killall <process-name> I just used it in my non root account, I wouldn't be able to do it if it wasn't for this Answer.
-
SDsolar almost 6 yearsThe advantage to not needing PIDs is in cron jobs. Using names works out cleanly.
-
SDsolar almost 6 yearsThis is definitely the Unix Way. Well done both of you. I will use this one.
-
Josh over 4 years
top
is a nice command I like to use to see what processes are running and a little more information on how much resources they are using etc. -
Egor Pavlikhin over 4 yearsWhat is -15 and what is -1?
-
Danijel about 3 yearsThis blocked my mouse cursor and I had to do
sudo killall xkill
!