Is there any way of killing all instances of a specific program with a command-line command?
-
12Which OS? It's killall under *ix. – Dave C Mar 12 '13 at 19:42
-
1This question is too broad, unless you specify an OS or two you want to accomplish this on. – Karan Mar 13 '13 at 02:59
7 Answers
In GNU/Linux, BSD, OS X, and other Unix-likes
killall program
In Windows
taskkill /IM program.exe
- 175
- 87,539
- 63
- 263
- 308
-
6Careful with "other Unix-likes": On Solaris,
killall, well, kills all: http://tehtable.wordpress.com/2009/12/07/note-to-self-solaris-linux/ – us2012 Mar 13 '13 at 08:58 -
On many system you will find the commands kill and killall.
If you know the PID of the process then you can use kill PID
The first kills only one specific process. (Or rather, it sends a signal to it, e.g. the signal to terminate). You can write a wrapper around that with ps and grep to kill all processes matching a name.
or, if installed, you could use killall
Beware though, not all killall commands do the same thing. On Solaris it kills all processes. I repeat, all. Not just those you wanted but each and every process you have the rights to kill will get killed. Make sure you check the manual page of your local system and or check if it is a link to killall5.
- 103
- 65,142
-
Nice. So is killall5 the nasty one or the one that kills the processes you wanted to? – LarsH Mar 13 '13 at 02:05
-
On Windows 7 (Vista?), I prefer tskill processname as you don't need to remember command line switches or write .exe at the end. eg:
tskill chrome
Will kill all chrome processes.
On windows XP I used pskill from the pstools suite, which uses a similar syntax. Both these commands can also work on remote computers, if you have admin rights.
- 1,155
- 1
- 9
- 18
In windows if you want to kill a process and any child processes which were started by it you should use this command Taskkill /im program.exe /t
- 121
for Windows, you can use
taskkill /im program_name
use taskkill /im program_name /f for more problematic programs
Use ProcessExplorer if you want a GUI alternative for Taskmanager
- 1,641
On Linux, the command is either pkill or killall. pkill is generally recommended, since on some systems, killall will actually kill all processes.
- 1,798
-
dis ~ # killall Usage: killall [OPTION]... [--] NAME... killall -l, --list killall -V, --version
– elcash Mar 13 '13 at 05:55-e,--exact require exact match for very long names -I,--ignore-case case insensitive process name match ... -
1@Brendan Long: It is not an urban legend. On some SYS V systems
killallactually kills all. That is not necessary a bad thing, but if you are not expecting it to behave differently on a different system then you might get an educational moment. – Hennes Mar 13 '13 at 11:46