Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

6 Answers

up vote 22 down vote accepted

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

share|improve this answer
4  
Some nice tips. I'm also keen on killall –  Oli Feb 17 '12 at 1:34
    
Thanks, edited for completeness. –  Ubuntu_kwr Feb 17 '12 at 2:24
1  
I'd start with kill -15 -1, and only move on to kill -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 Feb 17 '12 at 7:38
    
Also, Firefox's process is named firefox-bin. –  Simon Richter Feb 17 '12 at 7:39
    
No, you can try running killall firefox and killall firefox-bin and see what works. I agree with your first comment. –  Ubuntu_kwr Feb 17 '12 at 16:06
add comment

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

share|improve this answer
1  
I don't think this is relevant to this question, you are using sudo -- the OP has not such privileges, as mentioned in the question. –  pl1nk Jun 24 '12 at 23:01
    
The OP doesn't have privileges, please edit your answer or it may be deleted or converted into a comment as "not an answer". –  izx Jun 25 '12 at 6:28
add comment

To try to kill all processes owned by a user username, run:

pkill -U username
share|improve this answer
add comment

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.

share|improve this answer
add comment

I wrote a little script I wrote to kill (in my case) Skype...

kill -s 9 `ps aux | grep skype | head -n 1 | cut -f4 -d" "`

BUT I found that as much as that worked then... it didn't work the next day because the pid was a different length and there for the amount of spaces was different

then I cam across this forum and tried

pgrep -l -u justin

which conveniently outputs the processed in the format

[sid]    [name]

so I adjusted my code in the script to this:

kill -s 9 `pgrep -l -u justin | grep skype | cut -f1 -d" "`

What this does is pipes all of the processes justin is running (that can be changed to any user name) to grep which looks for skype (this can be changed to your process) and then pipes that line to cut which then reads only the sid and finally uses that sid in the kill command to kill it

Hope this helps someone :)

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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