Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

9 Answers 9

up vote 54 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


ps -ef | grep bob

share|improve this answer
Some nice tips. I'm also keen on killall –  Oli Feb 17 '12 at 1:34
Thanks, edited for completeness. –  ste_kwr Feb 17 '12 at 2:24
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. –  ste_kwr Feb 17 '12 at 16:06

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

share|improve this answer
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

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

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

pkill -U username
share|improve this answer

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

share|improve this answer
Use it second in frequency after pkill nd love it. +1 –  Serg May 3 at 0:11
xkill doesnt work in this case... –  PythoNic Sep 29 at 12:22
@PythoNic in what case is that? –  Alvar Oct 1 at 17:31
He 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.) –  PythoNic 2 days ago

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
share|improve this answer

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

...All processes in Linux respond to signals. Signals are an os-level way of telling programs to terminate or modify their behavior.

How To Send Processes Signals by PID

The most common way of passing signals to a program is with the kill command.

As you might expect, the default functionality of this utility is to attempt to kill a process:

kill PID_of_target_process

This sends the TERM signal to the process. The TERM signal tells the process to please terminate. This allows the program to perform clean-up operations and exit smoothly.

If the program is misbehaving and does not exit when given the TERM signal, we can escalate the signal by passing the KILL signal:

kill -KILL PID_of_target_process

This is a special signal that is not sent to the program.

Instead, it is given to the operating system kernel, which shuts down the process. This is used to bypass programs that ignore the signals sent to them...

share|improve this answer

I'd break your problem into 2 parts:

1) How do I find the processes started by me? Run this:

ps -u `whoami`

The whoami is just in case you don't know the name of the account you are using, otherwise just type the name of the account without the back quotes.

This will list all processes that can be deleted by your account.

2) The ps command will list the process number, the TTY, Time, and CMD. The process ID is the first column. Use that number to kill the process. Be careful while killing the process. You might break something if you kill the wrong process. To kill a process you will use the kill command, which sends a SIGNAL to the process. The signal indicates what the process should do. For example, sending a -1 to the process will ask it to reload the configuration file; sending a -2 is equivalent to pressing the Control+C on that process; -9 will cause the kernel to abandon the process, without communicating it to the process.

Supposing that ps -u whoami returned something like

  PID TTY          TIME CMD
 4333 pts/1    00:00:00 fish
 4335 ?        00:00:00 fishd
 4816 ?        00:00:00 intellij
 4868 ?        00:50:42 java
 4939 ?        00:00:19 fsnotifier64
 7667 ?        02:49:08 firefox
 7698 ?        00:00:00 unity-webapps-s

And you wanted to kill the firefox process by its process id, then you'd do:

kill -1 7667

Then you'd re-run the same ps command and check if the process was still running. If it is still running, then do a

kill -2 7667

working your way up to -9.

To kill all processes started by your account, enter kill <level> -1. Same as before: work your way up to -9.

If you know the name of the process you can simply go killall <processname>, where the is what you are trying to kill. For example: killall fish (fish, in this sense, is the Friendly Interactive SHell).

Documentation for killall can be found here:

share|improve this answer

Your Answer


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.