How do I kill processes in Ubuntu?
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.
process users kill
add a comment |
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.
process users kill
add a comment |
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.
process users kill
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.
process users kill
process users kill
edited Feb 7 '13 at 0:27
Eliah Kagan
82.3k22227367
82.3k22227367
asked Feb 16 '12 at 23:49
djangofandjangofan
1,59121727
1,59121727
add a comment |
add a comment |
13 Answers
13
active
oldest
votes
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
2
I'd start withkill -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
Feb 17 '12 at 7:38
Also, Firefox's process is namedfirefox-bin
.
– Simon Richter
Feb 17 '12 at 7:39
No, you can try runningkillall firefox
andkillall firefox-bin
and see what works. I agree with your first comment.
– ste_kwr
Feb 17 '12 at 16:06
Thanks @ste_kwr, worked with your instructions, after struggling for two days...
– Java.beginner
Feb 11 '16 at 14:19
The advantage to not needing PIDs is in cron jobs. Using names works out cleanly.
– SDsolar
Jun 8 '18 at 0:52
add a comment |
Use sudo kill <pid>
or sudo killall <process-name>
2
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".
– ish
Jun 25 '12 at 6:28
If 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.
– Shailyn Ortiz
Jan 27 '18 at 14:45
add a 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.
add a comment |
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
add a 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.
Use it second in frequency after pkill nd love it. +1
– Sergiy Kolodyazhnyy
May 3 '15 at 0:11
xkill doesnt work in this case...
– PythoNic
Sep 29 '15 at 12:22
@PythoNic in what case is that?
– Alvar
Oct 1 '15 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
Oct 2 '15 at 9:30
add a comment |
To try to kill all processes owned by a user username
, run:
pkill -U username
add a comment |
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: http://manpages.ubuntu.com/manpages/hardy/man1/killall.1.html
add a comment |
With this application you can view program listings
install htop
sudo apt-get install htop
for see process and kill process
You can install it and simply delete
add a comment |
...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...
add a 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 came across this site and tried
pgrep -l -u justin
which conveniently outputs processes in the format
[pid] [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 PID and finally uses that PID in the kill
command to kill it.
You 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).
– muru
Feb 12 '16 at 21:07
This is definitely the Unix Way. Well done both of you. I will use this one.
– SDsolar
Jun 8 '18 at 0:58
add a comment |
I used following procedure to kill a process in Ubuntu ::
Step 1 : Get the pid of the process by using grep or you can use -C also ::
ps aux | -C 'filename'
or
ps -ef | -C 'filename'
or
ps aux | grep 'filename'
or
ps -ef | grep 'filename'
Step 2 : Note the pid number .
Step 3 : Use 'kill' command alongwith the pid number as :
kill pidnumber
add a comment |
Here's a simple python script I wrote, killProcess.py, which will accept anything as an input and kill that.
I wrote this script because I have a lot of python or node processes that I want to kill individually and programatically. I can't use "killall python" because it will stop the processes that I need to keep running.
Please name the file "killProcess.py", then add the name of the script you want to stop. E.g.: python killProcess.py runnablePoller.py will kill the runnablePoller.py file
import os;
import sys;
for arg in sys.argv:
if(arg!="killProcess.py"):
process=arg;
print(process);
processes =os.popen("ps -ef | grep "+process).read();
processes=processes.split("n");
processes=processes[0].split(" ");
#print(processes);
for p in processes:
try:
pid=int(p);
print(pid);
break;
except:
continue;
os.system("kill "+str(pid));
add a comment |
Ctrl+Alt+Delete can be set to give you access to the task manager, from where it's easy to kill processes with a couple clicks, and for me, less requirement for remembering commands that could be damaging if done wrong:
http://ubuntuhandbook.org/index.php/2013/07/use-ctrl-alt-del-task-manager-ubuntu/
https://www.itsmarttricks.com/a-guide-to-kill-pkill-and-killall-commands-to-stop-the-process-in-linux-kill-process-linux/
add a comment |
protected by Community♦ Jun 8 '18 at 16:30
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
13 Answers
13
active
oldest
votes
13 Answers
13
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
2
I'd start withkill -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
Feb 17 '12 at 7:38
Also, Firefox's process is namedfirefox-bin
.
– Simon Richter
Feb 17 '12 at 7:39
No, you can try runningkillall firefox
andkillall firefox-bin
and see what works. I agree with your first comment.
– ste_kwr
Feb 17 '12 at 16:06
Thanks @ste_kwr, worked with your instructions, after struggling for two days...
– Java.beginner
Feb 11 '16 at 14:19
The advantage to not needing PIDs is in cron jobs. Using names works out cleanly.
– SDsolar
Jun 8 '18 at 0:52
add a comment |
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
2
I'd start withkill -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
Feb 17 '12 at 7:38
Also, Firefox's process is namedfirefox-bin
.
– Simon Richter
Feb 17 '12 at 7:39
No, you can try runningkillall firefox
andkillall firefox-bin
and see what works. I agree with your first comment.
– ste_kwr
Feb 17 '12 at 16:06
Thanks @ste_kwr, worked with your instructions, after struggling for two days...
– Java.beginner
Feb 11 '16 at 14:19
The advantage to not needing PIDs is in cron jobs. Using names works out cleanly.
– SDsolar
Jun 8 '18 at 0:52
add a comment |
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
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
edited Apr 13 '17 at 12:24
Community♦
1
1
answered Feb 16 '12 at 23:58
ste_kwrste_kwr
5,70482334
5,70482334
2
I'd start withkill -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
Feb 17 '12 at 7:38
Also, Firefox's process is namedfirefox-bin
.
– Simon Richter
Feb 17 '12 at 7:39
No, you can try runningkillall firefox
andkillall firefox-bin
and see what works. I agree with your first comment.
– ste_kwr
Feb 17 '12 at 16:06
Thanks @ste_kwr, worked with your instructions, after struggling for two days...
– Java.beginner
Feb 11 '16 at 14:19
The advantage to not needing PIDs is in cron jobs. Using names works out cleanly.
– SDsolar
Jun 8 '18 at 0:52
add a comment |
2
I'd start withkill -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
Feb 17 '12 at 7:38
Also, Firefox's process is namedfirefox-bin
.
– Simon Richter
Feb 17 '12 at 7:39
No, you can try runningkillall firefox
andkillall firefox-bin
and see what works. I agree with your first comment.
– ste_kwr
Feb 17 '12 at 16:06
Thanks @ste_kwr, worked with your instructions, after struggling for two days...
– Java.beginner
Feb 11 '16 at 14:19
The advantage to not needing PIDs is in cron jobs. Using names works out cleanly.
– SDsolar
Jun 8 '18 at 0:52
2
2
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
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
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
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
Thanks @ste_kwr, worked with your instructions, after struggling for two days...
– Java.beginner
Feb 11 '16 at 14:19
Thanks @ste_kwr, worked with your instructions, after struggling for two days...
– Java.beginner
Feb 11 '16 at 14:19
The advantage to not needing PIDs is in cron jobs. Using names works out cleanly.
– SDsolar
Jun 8 '18 at 0:52
The advantage to not needing PIDs is in cron jobs. Using names works out cleanly.
– SDsolar
Jun 8 '18 at 0:52
add a comment |
Use sudo kill <pid>
or sudo killall <process-name>
2
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".
– ish
Jun 25 '12 at 6:28
If 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.
– Shailyn Ortiz
Jan 27 '18 at 14:45
add a comment |
Use sudo kill <pid>
or sudo killall <process-name>
2
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".
– ish
Jun 25 '12 at 6:28
If 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.
– Shailyn Ortiz
Jan 27 '18 at 14:45
add a comment |
Use sudo kill <pid>
or sudo killall <process-name>
Use sudo kill <pid>
or sudo killall <process-name>
answered Feb 16 '12 at 23:50
Chris WayneChris Wayne
2,391920
2,391920
2
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".
– ish
Jun 25 '12 at 6:28
If 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.
– Shailyn Ortiz
Jan 27 '18 at 14:45
add a comment |
2
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".
– ish
Jun 25 '12 at 6:28
If 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.
– Shailyn Ortiz
Jan 27 '18 at 14:45
2
2
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
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".
– ish
Jun 25 '12 at 6:28
The OP doesn't have privileges, please edit your answer or it may be deleted or converted into a comment as "not an answer".
– ish
Jun 25 '12 at 6:28
If 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.
– Shailyn Ortiz
Jan 27 '18 at 14:45
If 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.
– Shailyn Ortiz
Jan 27 '18 at 14:45
add a 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.
add a 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.
add a 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.
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.
edited Jan 12 '14 at 5:42
answered Jan 12 '14 at 4:41
FantomasFantomas
20123
20123
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
edited May 3 '15 at 0:02
heemayl
67k9142214
67k9142214
answered Jul 22 '14 at 6:21
Xman ClassicalXman Classical
25125
25125
add a comment |
add a 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.
Use it second in frequency after pkill nd love it. +1
– Sergiy Kolodyazhnyy
May 3 '15 at 0:11
xkill doesnt work in this case...
– PythoNic
Sep 29 '15 at 12:22
@PythoNic in what case is that?
– Alvar
Oct 1 '15 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
Oct 2 '15 at 9:30
add a 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.
Use it second in frequency after pkill nd love it. +1
– Sergiy Kolodyazhnyy
May 3 '15 at 0:11
xkill doesnt work in this case...
– PythoNic
Sep 29 '15 at 12:22
@PythoNic in what case is that?
– Alvar
Oct 1 '15 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
Oct 2 '15 at 9:30
add a 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.
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.
edited Dec 27 '13 at 21:41
answered Dec 27 '13 at 21:36
AlvarAlvar
11.6k2779127
11.6k2779127
Use it second in frequency after pkill nd love it. +1
– Sergiy Kolodyazhnyy
May 3 '15 at 0:11
xkill doesnt work in this case...
– PythoNic
Sep 29 '15 at 12:22
@PythoNic in what case is that?
– Alvar
Oct 1 '15 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
Oct 2 '15 at 9:30
add a comment |
Use it second in frequency after pkill nd love it. +1
– Sergiy Kolodyazhnyy
May 3 '15 at 0:11
xkill doesnt work in this case...
– PythoNic
Sep 29 '15 at 12:22
@PythoNic in what case is that?
– Alvar
Oct 1 '15 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
Oct 2 '15 at 9:30
Use it second in frequency after pkill nd love it. +1
– Sergiy Kolodyazhnyy
May 3 '15 at 0:11
Use it second in frequency after pkill nd love it. +1
– Sergiy Kolodyazhnyy
May 3 '15 at 0:11
xkill doesnt work in this case...
– PythoNic
Sep 29 '15 at 12:22
xkill doesnt work in this case...
– PythoNic
Sep 29 '15 at 12:22
@PythoNic in what case is that?
– Alvar
Oct 1 '15 at 17:31
@PythoNic in what case is that?
– Alvar
Oct 1 '15 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
Oct 2 '15 at 9:30
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
Oct 2 '15 at 9:30
add a comment |
To try to kill all processes owned by a user username
, run:
pkill -U username
add a comment |
To try to kill all processes owned by a user username
, run:
pkill -U username
add a comment |
To try to kill all processes owned by a user username
, run:
pkill -U username
To try to kill all processes owned by a user username
, run:
pkill -U username
edited Feb 7 '13 at 11:37
Eliah Kagan
82.3k22227367
82.3k22227367
answered Feb 7 '13 at 2:30
user129146user129146
8111
8111
add a comment |
add a comment |
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: http://manpages.ubuntu.com/manpages/hardy/man1/killall.1.html
add a comment |
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: http://manpages.ubuntu.com/manpages/hardy/man1/killall.1.html
add a comment |
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: http://manpages.ubuntu.com/manpages/hardy/man1/killall.1.html
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: http://manpages.ubuntu.com/manpages/hardy/man1/killall.1.html
edited May 5 '15 at 16:37
answered May 4 '15 at 23:37
Alexandre SantosAlexandre Santos
305210
305210
add a comment |
add a comment |
With this application you can view program listings
install htop
sudo apt-get install htop
for see process and kill process
You can install it and simply delete
add a comment |
With this application you can view program listings
install htop
sudo apt-get install htop
for see process and kill process
You can install it and simply delete
add a comment |
With this application you can view program listings
install htop
sudo apt-get install htop
for see process and kill process
You can install it and simply delete
With this application you can view program listings
install htop
sudo apt-get install htop
for see process and kill process
You can install it and simply delete
edited Aug 28 '17 at 1:05
muru
1
1
answered May 27 '17 at 12:21
Reza BojnordiReza Bojnordi
206214
206214
add a comment |
add a comment |
...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...
add a comment |
...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...
add a comment |
...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...
...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...
edited May 3 '15 at 1:29
muru
1
1
answered May 3 '15 at 0:00
jackal404258jackal404258
212
212
add a comment |
add a 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 came across this site and tried
pgrep -l -u justin
which conveniently outputs processes in the format
[pid] [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 PID and finally uses that PID in the kill
command to kill it.
You 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).
– muru
Feb 12 '16 at 21:07
This is definitely the Unix Way. Well done both of you. I will use this one.
– SDsolar
Jun 8 '18 at 0:58
add a 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 came across this site and tried
pgrep -l -u justin
which conveniently outputs processes in the format
[pid] [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 PID and finally uses that PID in the kill
command to kill it.
You 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).
– muru
Feb 12 '16 at 21:07
This is definitely the Unix Way. Well done both of you. I will use this one.
– SDsolar
Jun 8 '18 at 0:58
add a 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 came across this site and tried
pgrep -l -u justin
which conveniently outputs processes in the format
[pid] [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 PID and finally uses that PID in the kill
command to kill it.
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 came across this site and tried
pgrep -l -u justin
which conveniently outputs processes in the format
[pid] [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 PID and finally uses that PID in the kill
command to kill it.
edited Feb 12 '16 at 21:09
muru
1
1
answered Dec 27 '13 at 21:10
justingiffardjustingiffard
211
211
You 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).
– muru
Feb 12 '16 at 21:07
This is definitely the Unix Way. Well done both of you. I will use this one.
– SDsolar
Jun 8 '18 at 0:58
add a comment |
You 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).
– muru
Feb 12 '16 at 21:07
This is definitely the Unix Way. Well done both of you. I will use this one.
– SDsolar
Jun 8 '18 at 0:58
You could have dropped the
-l
, and ran pgrep -u justin skype
, and to kill: pkill -u justin skype
(or pkill -KILL -u justin skype
to send SIGKILL).– muru
Feb 12 '16 at 21:07
You could have dropped the
-l
, and ran pgrep -u justin skype
, and to kill: pkill -u justin skype
(or pkill -KILL -u justin skype
to send SIGKILL).– muru
Feb 12 '16 at 21:07
This is definitely the Unix Way. Well done both of you. I will use this one.
– SDsolar
Jun 8 '18 at 0:58
This is definitely the Unix Way. Well done both of you. I will use this one.
– SDsolar
Jun 8 '18 at 0:58
add a comment |
I used following procedure to kill a process in Ubuntu ::
Step 1 : Get the pid of the process by using grep or you can use -C also ::
ps aux | -C 'filename'
or
ps -ef | -C 'filename'
or
ps aux | grep 'filename'
or
ps -ef | grep 'filename'
Step 2 : Note the pid number .
Step 3 : Use 'kill' command alongwith the pid number as :
kill pidnumber
add a comment |
I used following procedure to kill a process in Ubuntu ::
Step 1 : Get the pid of the process by using grep or you can use -C also ::
ps aux | -C 'filename'
or
ps -ef | -C 'filename'
or
ps aux | grep 'filename'
or
ps -ef | grep 'filename'
Step 2 : Note the pid number .
Step 3 : Use 'kill' command alongwith the pid number as :
kill pidnumber
add a comment |
I used following procedure to kill a process in Ubuntu ::
Step 1 : Get the pid of the process by using grep or you can use -C also ::
ps aux | -C 'filename'
or
ps -ef | -C 'filename'
or
ps aux | grep 'filename'
or
ps -ef | grep 'filename'
Step 2 : Note the pid number .
Step 3 : Use 'kill' command alongwith the pid number as :
kill pidnumber
I used following procedure to kill a process in Ubuntu ::
Step 1 : Get the pid of the process by using grep or you can use -C also ::
ps aux | -C 'filename'
or
ps -ef | -C 'filename'
or
ps aux | grep 'filename'
or
ps -ef | grep 'filename'
Step 2 : Note the pid number .
Step 3 : Use 'kill' command alongwith the pid number as :
kill pidnumber
answered May 27 '17 at 11:46
Akash KandpalAkash Kandpal
1215
1215
add a comment |
add a comment |
Here's a simple python script I wrote, killProcess.py, which will accept anything as an input and kill that.
I wrote this script because I have a lot of python or node processes that I want to kill individually and programatically. I can't use "killall python" because it will stop the processes that I need to keep running.
Please name the file "killProcess.py", then add the name of the script you want to stop. E.g.: python killProcess.py runnablePoller.py will kill the runnablePoller.py file
import os;
import sys;
for arg in sys.argv:
if(arg!="killProcess.py"):
process=arg;
print(process);
processes =os.popen("ps -ef | grep "+process).read();
processes=processes.split("n");
processes=processes[0].split(" ");
#print(processes);
for p in processes:
try:
pid=int(p);
print(pid);
break;
except:
continue;
os.system("kill "+str(pid));
add a comment |
Here's a simple python script I wrote, killProcess.py, which will accept anything as an input and kill that.
I wrote this script because I have a lot of python or node processes that I want to kill individually and programatically. I can't use "killall python" because it will stop the processes that I need to keep running.
Please name the file "killProcess.py", then add the name of the script you want to stop. E.g.: python killProcess.py runnablePoller.py will kill the runnablePoller.py file
import os;
import sys;
for arg in sys.argv:
if(arg!="killProcess.py"):
process=arg;
print(process);
processes =os.popen("ps -ef | grep "+process).read();
processes=processes.split("n");
processes=processes[0].split(" ");
#print(processes);
for p in processes:
try:
pid=int(p);
print(pid);
break;
except:
continue;
os.system("kill "+str(pid));
add a comment |
Here's a simple python script I wrote, killProcess.py, which will accept anything as an input and kill that.
I wrote this script because I have a lot of python or node processes that I want to kill individually and programatically. I can't use "killall python" because it will stop the processes that I need to keep running.
Please name the file "killProcess.py", then add the name of the script you want to stop. E.g.: python killProcess.py runnablePoller.py will kill the runnablePoller.py file
import os;
import sys;
for arg in sys.argv:
if(arg!="killProcess.py"):
process=arg;
print(process);
processes =os.popen("ps -ef | grep "+process).read();
processes=processes.split("n");
processes=processes[0].split(" ");
#print(processes);
for p in processes:
try:
pid=int(p);
print(pid);
break;
except:
continue;
os.system("kill "+str(pid));
Here's a simple python script I wrote, killProcess.py, which will accept anything as an input and kill that.
I wrote this script because I have a lot of python or node processes that I want to kill individually and programatically. I can't use "killall python" because it will stop the processes that I need to keep running.
Please name the file "killProcess.py", then add the name of the script you want to stop. E.g.: python killProcess.py runnablePoller.py will kill the runnablePoller.py file
import os;
import sys;
for arg in sys.argv:
if(arg!="killProcess.py"):
process=arg;
print(process);
processes =os.popen("ps -ef | grep "+process).read();
processes=processes.split("n");
processes=processes[0].split(" ");
#print(processes);
for p in processes:
try:
pid=int(p);
print(pid);
break;
except:
continue;
os.system("kill "+str(pid));
edited Nov 16 '17 at 11:55
derHugo
2,30521531
2,30521531
answered Jun 18 '17 at 19:39
nick carrawaynick carraway
1308
1308
add a comment |
add a comment |
Ctrl+Alt+Delete can be set to give you access to the task manager, from where it's easy to kill processes with a couple clicks, and for me, less requirement for remembering commands that could be damaging if done wrong:
http://ubuntuhandbook.org/index.php/2013/07/use-ctrl-alt-del-task-manager-ubuntu/
https://www.itsmarttricks.com/a-guide-to-kill-pkill-and-killall-commands-to-stop-the-process-in-linux-kill-process-linux/
add a comment |
Ctrl+Alt+Delete can be set to give you access to the task manager, from where it's easy to kill processes with a couple clicks, and for me, less requirement for remembering commands that could be damaging if done wrong:
http://ubuntuhandbook.org/index.php/2013/07/use-ctrl-alt-del-task-manager-ubuntu/
https://www.itsmarttricks.com/a-guide-to-kill-pkill-and-killall-commands-to-stop-the-process-in-linux-kill-process-linux/
add a comment |
Ctrl+Alt+Delete can be set to give you access to the task manager, from where it's easy to kill processes with a couple clicks, and for me, less requirement for remembering commands that could be damaging if done wrong:
http://ubuntuhandbook.org/index.php/2013/07/use-ctrl-alt-del-task-manager-ubuntu/
https://www.itsmarttricks.com/a-guide-to-kill-pkill-and-killall-commands-to-stop-the-process-in-linux-kill-process-linux/
Ctrl+Alt+Delete can be set to give you access to the task manager, from where it's easy to kill processes with a couple clicks, and for me, less requirement for remembering commands that could be damaging if done wrong:
http://ubuntuhandbook.org/index.php/2013/07/use-ctrl-alt-del-task-manager-ubuntu/
https://www.itsmarttricks.com/a-guide-to-kill-pkill-and-killall-commands-to-stop-the-process-in-linux-kill-process-linux/
edited Jan 14 at 8:29
PRATAP
2,8182728
2,8182728
answered May 27 '17 at 11:52
Cedric EveleighCedric Eveleigh
1269
1269
add a comment |
add a comment |
protected by Community♦ Jun 8 '18 at 16:30
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?