Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands using killall from sorted by
Terminal - Commands using killall - 36 results
killall conky
killall -HUP argument
2012-11-16 19:40:45
User: milarepa
Functions: killall
0

Example: killall - HUP firefox

Closes all instances processes matching firefox.

sudo killall -HUP mDNSResponder
2012-05-15 18:33:51
User: Xeno
Functions: killall sudo
0

Purges DNS cache of OS X.

dscacheutil -flushcache does not work since OS X 10.7.

while true ; do killall mc ; done
2012-04-13 08:03:41
User: unixhero
Functions: killall true
0

I use this loop for a variety of things. If a process won't die, I try to ask it nicely to let it die gracefully, and then i use killall and kill -9 to end its life. This will run the program killall and then start it again when it completes, indefinately.

killall "Google Chrome"
wineserver -k; killall -9 wine wineserver; for i in `ps ax|egrep "*\.exe"|grep -v 'egrep'|awk '{print $1 }'`;do kill -9 $i;done
2011-12-30 01:38:15
User: godmachine81
Functions: awk egrep grep kill killall
Tags: kill wine exe
0

The other 2 commands that are listed will also kill the egrep process and any libexec processes because the .exe isn't escaped so it is really using . meaning anything containing exe. The command i posted escapes the (dot) in .exe and then filters the actual egrep process so that it doesn't get killed before the other processes being killed. Also added the -9 switch for kill to send sigterm to the processes, in case people are wondering why processes aren't getting killed after running just kill . This should work better for people :)

killall -9 <processname>
for i in `ps -ef | grep tracker | awk '{print $8}' | cut -d'/' -f4 | grep -v grep`; do killall -9 $i; done
2011-12-04 13:20:19
User: alienone
Functions: awk cut grep killall
-3

* ps -ef # list running processes

* grep string

* pull the process names from 8th field

* cut and delimiter '/'

* print 4th field

* get rid of trailing grep

* for loop killall -9 $i which is the process name

killall -u username
killall -r 'Activ'
defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'; killall Dock
2011-07-26 02:05:17
User: ratonovitch
Functions: killall write
0

Insert an additional (moveable) spacer on the right side of the Dock in Mac OS X

defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'; killall Dock
2011-07-26 02:03:29
User: ratonovitch
Functions: killall write
0

Insert an additional (moveable) spacer on the left side of the Dock in Mac OS X

(sp-sc sop://broker.sopcast.com:3912/80562 8908 10999 &>/dev/null &); sleep 10; wait $(vlc http://localhost:10999); killall sp-sc
2011-04-06 00:08:38
User: Bonster
Functions: killall sleep wait
0

requires sp-auth installed

This command will auto kill sp-sc after vlc is closed, so u wont have to do it manually

killall -r 'a regular expression'
2011-03-07 07:29:42
User: dexterhu
Functions: killall
0

This is usefull when we don't know the exact name of the process, but the application name

A limitation is that the regular expression only tries to match the last part of the full command (i.e. the bin file name itself).

But this is way shorter than the following one:

ps axww | grep SomeCommand | awk '{ print $1 }' | xargs kill

radio() { if [ "$(pidof mpg123)" ] ; then killall mpg123; else mpg123 -q -@ http://173.236.29.51:8200 & fi }
2010-11-14 16:27:04
User: houghi
Functions: killall mpg123
1

Place it in your bashrc and running the command radio it will turn on or off each time it runs. Only one command needed. Obviously you can set it to any station you like.

killall xmms
killall <name>
sh -c 'if pgrep x2vnc && env LC_ALL=C xmessage -button "Kill it:0,Ignore it:1" "Another connection is already running. Should I kill it instead of ignoring it?"; then killall x2vnc; fi; x2vnc -passwd /home/Ariel/.vnc/passwd -east emerson:0'
2010-07-06 09:11:12
User: zhangweiwu
Functions: env killall sh
0

This command is suitable to use as application launching command for a desktop shortcut. It checks if the application is already running by pgrepping its process ID, and offer user to kill the old process before starting a new one.

It is useful for a few x11 application that, if re-run, is more likely a mistake. In my example, x2vnc is an x11 app that does not quit when its connection is broken, and would not work well when a second process establish a second connection after the first broken one.

The LC_ALL=C for xmesseng is necessary for OpenSUSE systems to avoid a bug. If you don't find needing it, remove the "env LC_ALL=C" part

killall rapidly_spawning_process ; killall rapidly_spawning_process ; killall rapidly_spawning_process
2010-05-20 00:26:10
Functions: killall
Tags: Linux unix kill
-2

Use this if you can't type repeated killall commands fast enough to kill rapidly spawning processes.

If a process keeps spawning copies of itself too rapidly, it can do so faster than a single killall can catch them and kill them. Retyping the command at the prompt can be too slow too, even with command history retrieval.

Chaining a few killalls on single command line can start up the next killall more quickly. The first killall will get most of the processes, except for some that were starting up in the meanwhile, the second will get most of the rest, and the third mops up.

killall -9 rouge-process
killall -INFO dd
2010-04-22 18:38:37
User: jearsh
Functions: killall
Tags: dd progress
15

"killall -USR1 dd" does not work in OS X for me. However, sending INFO instead of USR1 works.

while :;do killall -USR1 dd;sleep 1;done
2010-04-07 09:23:31
User: oernii2
Functions: killall
Tags: dd progress speed
9

every 1sec sends DD the USR1 signal which causes DD to print its progress.

dd if=/dev/sdc of=/dev/sdd conv=notrunc & while killall -USR1 dd; do sleep 5; done
2010-01-12 14:09:40
User: bw
Functions: dd killall sleep
3

The following command will clone usb stick inside /dev/sdc to /dev/sdd

Double check you got the correct usb sticks (origional-clone)with fdisk -l.

while killall -USR1 dd; do sleep 5; done
2009-11-09 00:27:33
User: Mikachu
Functions: killall sleep
0

Stops when the (last) dd process exits.