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.

Universal configuration monitoring and system of record for IT.
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

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

search for and kill a process in one blow

Terminal - search for and kill a process in one blow
ps aux|grep -i [p]rocessname|awk '{ print $2 }'|xargs kill
2010-04-10 18:42:27
User: billcarroll
Functions: awk grep ps xargs
-5
search for and kill a process in one blow

Alternatives

There are 3 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

pkill is better for that.

Comment by unixmonkey9257 324 weeks ago

Better? You mean shorter? Care to share examples and explain? Seems like the thing to do if you are going to vote it down and all.

Comment by billcarroll 324 weeks ago

I just use

killall <procname>
Comment by kaedenn 324 weeks ago

FYI ... There are issues using killall with names over 15 characters, and "Killing by file name only works for executables (i.e., runnable programs) that are kept open during execution. Also, killall may not have the desired effect in some situations, including on some non-Linux systems, in which case kill provides a viable alternative. - http://www.linfo.org/killall.html

Comment by billcarroll 324 weeks ago

That would be nice to have as an alias, does anyone know how to do that?

Comment by kodiak68 323 weeks and 6 days ago

The first comment is right, I also use pkill for this. It's very simple to use, for example:

pkill ssh-agent

Also it is fairly portable, at least it also exists on BSD and Solaris, while ps syntax isn't really portable.

By the way, there's a companion tool called pgrep that just lists the PID numbers.

Another alternative would be the "killall" tool, but its syntax and behaviour differs slightly between operating systems which is somewhat dangerous. Therefore I prefer pkill.

Comment by inof 323 weeks and 6 days ago

pkill is not portable, and neither is pgrep. I'm working on OSX and neither exists on a Mac.

I can't think of a nix where ps doesn't do the job this command requires. If you can I'd love to hear about it. While different vendors customize ps, it's always present and returning PIDs.

Comment by billcarroll 323 weeks and 6 days ago

Despite all of the voting down, nobody has managed to post a better or more portable command to "search for and kill a process in one blow".

pkill does not do it on all platforms and killall does not kill processes, only running applications.

Comment by billcarroll 323 weeks and 6 days ago

You think ps is portable? ps is the prime example for commands that are not portable. It's syntax is complete different between SysV and BSD-derived systems, and Linux has taken a bit from everywhere, which is even more confusing.

Try entering "ps wwaux" on a Solaris machine. It will respond with a usage error. (By the way, the third "w" is superfluous.)

pkill is definietly more portable than ps, at least it works the same way on Linux, Solaris and BSD systems. Even AIX and HP-UX have it in their current versions. I'm surprised that Mac OS X doesn't have it, as it's partly BSD-derived, but well, that's probably bad luck then.

Comment by inof 323 weeks and 6 days ago

You are incorrect on all three counts:

1. ps wwwaux will run on Solaris, and if you preface with sudo it will return more than the 80 char limit.

2. pkill is not more portable, it is less portable. ps is on every nix distribution, pkill is not.

3. the 3rd 'w' is not superfluous.

Comment by billcarroll 323 weeks and 6 days ago

For kodiak68, here is one way you can create an alias for the command:

http://www.theorionsky.com/2010/04/pkill-improved-the-mac-edition/

Comment by billcarroll 323 weeks and 5 days ago

I'm afraid it's you who is wrong.

1. If "ps wwwaux"works for you on Solaris, then you have /usr/ucb before /bin or /usr/bin in your $PATH, which is generally not recommended because of subtle side effects. All of this is explained in the ps(1) manual page on Solaris, so I suggest you read it.

2. A command is not portable just because it's present. For portability the usage of a tool is also important. Therefore ps is not very portable. As I said, ps is the prime example of portability problems between BSD and SysV systems.

3. The third "w" is superfluous. See the manual page. The first "w" changes the output width to 132 characters (the default is 80). The second one removes all output width limitations. The third "w" doesn't change anything. If your ps behaves differently, then that's just another proof for the portability problems of ps.

Comment by inof 323 weeks and 5 days ago

So, let me see if I hear you correctly. PS is on Solaris? Nice. Next, lets establish that you can't find a *nix distribution where ps does not return a PID in second position. Nice again. Third, let's establish that pkill is not on a number of *nixes. Again, you have done nothing but prove my points ... well, that and be acerbically unhelpful. Thanks :)

Comment by billcarroll 323 weeks and 5 days ago

inof ... to give credit where credit is due, I did discover how I got into the habit of using 'ps auxwww'. I picked it up from a friend who explains his use of it as: "on old solaris/vax etc systems 'www' made it 'really wide' ;-) i don't now if this is true anymore, but - habbit."

I notice that there are quite a few people still using a 3rd 'w' but I'll be damned if I can find a place listing it as necessary. I'm guessing there is a reason out there somewhere.

Also, in the context of the command I posted, using 'w' at all does not appear to be necessary. I'm going to change the command and remove 'www'.

So, thanks.

Comment by billcarroll 323 weeks and 5 days ago

http://www.christianlouboutin.in.net

http://www.airjordanretro.uk

http://www.oakleyglasses.com.co

http://www.mlbjerseysauthentic.in.net

http://www.cheap--jordans.us.com

http://www.ugg.name

http://www.mlbjerseyscheap.in.net

http://www.tiffanyand.co.uk

http://www.cheapralphlauren.in.net

http://www.michaelkorshandbagsoutlet.eu.com

http://www.huaracheshoes.uk

http://www.michaelkorsoutletstoreonline.com.co

http://www.toms-outletstore.us.com

http://www.fitflopsoutlet.in.net

http://www.jordansforcheap.us.com

http://www.cheapretro-jordans.com

http://www.zoomkb24.com

http://www.oakleysunglassescheap-sale.com

http://www.tiffanyandco-outlet.us.com

http://www.nfljerseyscheap.in.net

http://www.cheapbasketballshoes.us.com

http://www.coach-outlet.in.net

http://www.tomsoutletstore.us.com

http://www.jordanretro.uk

http://www.jewelrytiffanyand.co

http://www.cheapairjordan.us

http://www.cheapairjordan.in.net

http://www.chromehearts.in.net

http://www.adidasnmd.uk

http://www.kobebasketballshoes.net

http://www.minireplicahut.com

http://www.outletmichaelkorsinc.com

http://www.11jordanshoes.com

http://www.oakleysunglassesoutlet.us

http://www.uggoutlet.uk

http://www.michaeljordanshoes.us.com

http://www.cheapnfljerseysonlinestore.com

http://www.oakley-sunglassescheapsale.com

http://www.tomsoutletstore.name

http://www.adidasnmd.com.co

http://www.michaelkors-handbags.net

http://www.huarachesshoes.uk

http://www.raybansunglass.uk

http://www.discount-oakleysunglasses.us.com

http://www.michaelkorspurse.com.co

http://www.michaelkorsonline.net

http://www.michaelkorshandbagsclearance.com.co

http://www.airhuaraches.org.uk

http://www.michaeljordanshoes.net

http://www.michaelkorsoutletsfactory.us.com

http://www.mlbjerseyswholesale.in.net

http://www.oakleyvault.com.co

http://www.michaelkors-outletstores.in.net

http://www.michaelkorshandbags.net

http://www.nfljerseyswholesale.in.net

http://www.kobe-shoes.us.com

http://www.oakleysunglassescheapssale.com

http://www.2016michaelkorsoutlet.us.com

http://www.michaelkors-outletfactory.us.com

http://www.outlettiffanyandco.us.com

http://www.outlettiffanyand.co

http://www.truereligiononsale.in.net

http://www.raybansunglass.us

http://www.oakleysunglasses-cheapsale.com

http://www.louis-vuittonhandbags.net

http://www.cheaptiffanyandco.in.net

http://www.oakley-sunglasses.co

http://www.airhuarache.uk

http://www.kobeshoes.uk

http://www.outletmichaelkors.com.co

http://www.fitflops.cc

http://www.jewellerytiffanyand.co

http://www.michaelkors-outletonline.co.uk

http://www.michaelkorsonline.name

http://www.cheaptruereligionjeans.us

http://www.fitflopssandals.net

http://www.cheapralphlaurenonline.uk

http://www.chromehearts.com.co

http://www.outletonlinemichaelkors.us.org

http://www.authenticjordanscheap.us.com

http://www.kobesneakers.com

http://www.huarachesshoes.co.uk

http://www.michaelkorsoutletonline.uk

http://www.nfljerseys2015.in.net

http://www.chinajerseyssaleonline.com

http://www.cheap-airjordans.us.com

http://www.fitflops.com.co

http://www.raybansunglassesoutlet.org

http://www.michaelkors-outletonlines.us.com

http://www.cheapairjordan.uk

http://www.tiffany.net.co

http://www.zoomkb24.uk

http://www.raybanglasses.in.net

http://www.oakleystoreonline.us.org

http://www.cheapnfljerseysstorechina.com

http://www.michaelkorsoutlets-online.eu.com

http://www.tiffanyandcouk.uk

http://www.rayban-sunglasses.uk

http://www.michael-kors-handbags.com.co

http://www.tiffanyandcojewellery.us.com

http://www.fitflopsoutlet.uk

http://www.cheapauthenticjordans.us.com

http://www.oakleyoutlet-store.com

http://www.oakleysunglassescheapsales.com

http://www.airjordan.cc

http://www.christian-louboutin-outlet.uk

http://www.nikedunks.us.org

http://www.michaelkors-outletstore.us.com

http://www.tiffanyandcooutletonline.us.com

http://www.cheaprealjordans.us.com

http://www.cheaprolexwatchesonline.in.net

http://www.nmdadidas.us.com

http://www.kobebasketballshoes.us.com

http://www.oakley-sunglass.in.net

http://www.oakleyssunglassescheapsale.com

http://www.cheap-jordanshoessale.com

http://www.michaelkorsoutletin.net

http://www.chromeheartsonline.us.com

Comment by sanjunn 4 weeks and 3 days ago

2016-6-7 leilei

"Tweed is an excellent fabric especially when you are living in place like London. London is known for its cold weather and in such climate, tweed works absolutely fine. One of the biggest advantages of buying a tweed suit is that you it can be worn all together or can be incorporated separately into pieces in your wardrobe. Tweed suits in London is quite famous amongst men. So let us understand, what exactly tweed fabric is.

What is Tweed?

Tweed is a warm rough to touch fabric and was originated in Scotland. The reason why tweed suits in London are famous is because of its loose weave which makes it flexible and comfortable during winters. The tweed fabric is referred to the weave of fabric; therefore when you see different kinds of tweed, it would tell you the pattern it has been woven. One of the most popular kinds of tweed is the herringbone tweed which a diagonally v-shaped black and white weave. The herringbone tweed gives a rich visual texture and known for its versatility.

Ways to wear Tweed in winters

Everybody needs to wear warm clothes during the winter month to protect from the chilly weather outside. However, many people think that they might have to compromise fashion during those chilly months. Not now! There are many fabrics that you can use to protect yourself from the weather as well as still enjoy great looks. Tweed is one of the fabrics that can make you awesome even in winters as well. Below are some ways of how you can incorporate tweed with other pieces in your wardrobe

"

http://www.raybanssunglasses.us.org

http://www.poloralphlaurenmen.name

http://www.burberrysale.me.uk

http://www.nike-airmax90.me.uk

http://www.ralph-lauren-pas-cher.fr

http://www.yeezyboost-350.us.com

http://www.jordan-femmepascher.fr

http://www.airmaxoutletsaleus.com

http://www.cheapmlbjerseys.us

http://www.adidas-shoes.me.uk

http://www.basketballshoes.net.co

http://christianlouboutin.eshopping.us.com

http://www.airmax90.org

http://www.cheapfakeoakleysoutlet.com

http://www.designerhandbags.net.co

http://www.airjordan-uk.org.uk

http://www.levisjeans.name

http://www.fitflopssaleclearance.net

http://www.pradaoutlet.name

http://www.yeezyboost350.me.uk

http://www.michael-korshandbagsoutlet.us.com

http://www.louisvuittonoutletonline.us.org

http://www.coachfactoryoutlet-online.com.co

http://www.hollisterclothingstore.com.co

http://www.abercrombieandfitchoutlet.name

http://www.rayban-outletstoreonline.com

http://canadagoose.shopgioia.com

http://www.ghdflatiron.com

http://www.christianlouboutinoutlet.us

http://www.kobeshoes.name

http://www.pandorajewelryoutlet.name

http://www.birkenstocks.name

http://www.longchampoutlet.net.co

http://www.truereligionjeans.me.uk

http://www.chaussure-louboutin.fr

http://www.coachfactoryoutletonline.us.org

http://www.louisvuittonoutlet.ca

http://www.adidasnmd.org.uk

http://www.tiffanyjewelryoutlet.name

http://www.michaelkorsoutletclearance.net.co

http://www.louboutin.eu.com

http://www.yeezyboost.us.com

http://www.thenorthfaceoutlet.com.co

http://www.montblancoutletpens.com

http://coach.eshopping.us.com

http://www.cheap-nbajerseys.us.com

http://www.thenorthface.org.uk

http://www.ralphlauren-outlet.com.co

http://ralphlauren.shopgioia.com

http://www.kate-spadeoutlet.com.co

http://www.adidasgazelle.me.uk

http://www.gucci-borse.it

http://www.tomsoutletstores.in.net

http://ugg.eshopping.us.com

http://oakley.shopgioia.com

http://www.raybans.org.uk

http://www.fitflops.in.net

http://www.cheapraybansunglassesoutlet.us.com

http://www.skechersshoes.us

http://www.supraforsale.in.net

http://www.buyredbottomcheapshoesonline.com

http://www.oakley-sunglasses.us.com

http://www.fitflopuk.me.uk

http://www.burberry-outlet-canada.ca

http://www.discountnikeshoessc.org

http://www.truereligionjeansoutlet.name

http://www.nfl-jerseys-wholesale.us.com

http://www.toryburchoutlet.org

http://www.cheapjordans-shoes.us.com

http://www.vansshoes.in.net

http://www.raybansunglassesoutlet.in.net

http://www.nikefreerun.name

http://www.adidas-nmd.us.com

http://www.fitflops.us

http://www.truereligionoutlet.com.co

http://www.asicsshoes.in.net

http://www.new-balanceoutlet.us

http://www.edhardy-outlet.name

http://www.toms.in.net

http://www.armani-exchange.us

http://www.michaelkors-outlet.us.org

http://www.birkenstocksandals.us.com

http://www.instylermax.in.net

http://www.michael-korsoutlet.ca

http://www.underarmourshoes.cc

http://www.puma-shoes.in.net

http://www.oakley--sunglasses.us.org

http://www.omegawatches.name

http://www.niketrainers.com.co

http://www.coachoutletstoreonlineclearances.in.net

http://www.nike-airmax.org.uk

http://www.tiffanyandco.name

http://www.adidas-trainers.me.uk

http://www.katespadehandbags.net.co

http://www.birkenstocksandals.org.uk

http://www.raybans.in.net

http://www.tiffanyandcojewelry.org.uk

http://www.nikestoreuk.me.uk

http://www.ralphlaurenoutletuk.me.uk

http://www.oakley.nom.co

http://www.polooutlet.us.com

http://burberry.eshopping.us.com

http://www.diorsunglasses.us

http://www.michaelkorsoutletvip.in.net

http://www.ralphlaurenoutlet.us.org

http://www.longchampbag.co.uk

http://www.eccoshoes.us

http://www.pandoracharmsuk.org.uk

http://www.edhardyukclothing.me.uk

http://www.nike-tn-pascher.fr

http://www.coachfactoryonlineoutlet.com.co

http://www.louisvuitton-sac-pascher.fr

http://burberry.shopgioia.com

http://www.michaelkorshandbagsuk.me.uk

http://www.lacosteshoes.us

http://www.coachpursesoutlet.in.net

http://www.louisvuittonfactoryoutlet.us.com

http://www.michaelkorspurses.in.net

http://www.adidassuperstar.co.uk

http://www.ferragamoshoes.cc

http://www.rayban--outlet.com

http://www.true-religionjeans.net.co

http://www.nike-blazerlow.fr

http://www.cheapoakleysunglassesoutlet.us.com

http://www.louisvuittonoutletonlines.us.com

http://www.coachoutletstoreonline.com.co

http://www.raybansunglassesdiscount.us.com

http://www.reebokclassic.me.uk

http://abercrombie.shopgioia.com

http://www.kate-spadeoutlet.in.net

http://www.bottegaveneta.in.net

http://www.oakleysunglassesuk.org.uk

http://www.kate-spadeoutlet.us

http://canadagoose.eshopping.us.com

http://www.prada-sunglasses.us.com

http://www.louisvuittonoutlets-lv.com

http://ralphlauren.eshopping.us.com

http://www.hollisterclothing.org

http://www.poloralphlaurenoutletonlines.us.com

http://www.saclongchamp-solde.fr

http://www.louisvuittonhandbagsuk.me.uk

http://christianlouboutin.shopgioia.com

http://www.michaelkorsoutletclearance.com.co

http://www.adadasstansmith.com

http://www.nikerosherunwomen.me.uk

http://www.guccihandbagsoutlet.org

http://www.airmax95.org.uk

http://www.versace-sunglasses.us.com

http://www.versaceshoes.in.net

http://www.sac-longchamppliage.fr

http://www.michaelkorswatches.co.uk

http://www.michaelkors-outlet.ca

http://www.runningshoes.com.co

http://www.michaelkorsoutletonline.com.co

http://www.poloralphlauren.net.co

http://www.coach-outletonline.us.org

http://www.rolex-replicawatches.com.co

http://www.christianlouboutinuk.me.uk

http://www.pandorajewelryoutlet.org

http://www.nikefreeruns.uk

http://www.rolexwatchesuk.me.uk

http://www.nikefreeflyknit.name

http://www.adidasnmd.us.org

http://www.michaelkorsoutlet.net.co

http://www.mizunorunningshoes.in.net

http://www.michaelkorsoutletonlineclearance.us.com

http://www.cheapjordans.com.co

http://rayban.shopgioia.com

http://www.michael-kors-outlet.ca

http://www.michaelkorsoutlet-online.us.org

http://rayban.eshopping.us.com

http://www.katespadehandbags.org.uk

http://www.hollistersaleuk.me.uk

http://www.conversetrainer.co.uk

http://www.adadassupercolor.com

http://oakley.eshopping.us.com

http://www.fitflopssaleclearance.com

http://www.babylisspro.in.net

http://www.hermesbelt.in.net

http://www.cartierwatches.cc

http://www.timberlandbootsoutlet.name

http://www.pandoracharms.com.co

http://www.christianlouboutinshoes.org.uk

http://www.nikehuarache.com.co

http://www.jimmychoo.in.net

http://www.reebokshoes.in.net

http://www.discountoakleysunglasses.us.org

http://www.nikecortez.com.co

http://www.raybans.us.com

http://www.michaelkorshandbagsoutlet.in.net

http://www.hollisteruksale.org.uk

http://www.coach-outletonline.eu.com

http://www.louisvuitton-borse.it

http://www.stephencurryshoes.net

http://michaelkors.eshopping.us.com

http://www.cheap-jordans.us

http://www.coachfactoryoutletstoreonline.com

http://www.adidaspureboost.us

http://www.tomsshoes.us.com

http://www.airforce1-nike.fr

http://www.lebronjamesshoes.org

http://ugg.shopgioia.com

http://www.cheap-jerseyswholesale.us

http://www.chaussurelouboutin-pascher.fr

http://www.michaelkors-outlet.us.com

http://www.converseshoes.in.net

http://www.nikeairforce1.org.uk

http://www.coach-outletonlines.us.com

http://www.rolexdaytona.in.net

http://www.hermesuk.org.uk

http://www.nikefreeflyknit.org.uk

http://www.timberlandbootsuk.org.uk

http://hollister.shopgioia.com

http://www.adadassuperstar.com

http://www.sunglassesoakley.in.net

http://www.cheapnhljerseyswholesale.us

http://www.valentino.in.net

http://www.chiflatiron.in.net

"Casually ? if you are a starter with tweed then it is recommended to start with plain variety of tweed. You can wear a tweed jacket with dark blue jeans and high boots. Incorporate a neutral t-shirt or a winter shirt under the jacket.

At work ? Tweed suit in London are quite popular as one of the formal attires. Heavy woven tweeds can make you look older, so try buying tweed suits in London that are finely weaved and pair it with your regular shirts like white or blue with smart formal shoes. Believe it or not, it can win you praise at work.

Accessorise ? Apart from wearing tweed suits in London as attire you can even use accessories made out of tweed. Tweed caps, laptop bags, scarves, gloves are a smart way to incorporate tweed in your winter collection. It is also a safe way of using tweed fabric if you are not too comfortable wearing it. There is even footwear that has tweed as their centre fabric and looks awesome.

Taking care of Tweed

Though the fabric boasts itself about being tough and rugged, it still requires a good care to use it for coming years as well. Due to its weave structure it often pick up dirt and stains that can get hard to remove. Make sure you take your tweed clothes for dry cleaning as washing them in washing machines can make them shrink. Also, keep them in cool dry place so that they do not get attracted by moths.

"

Comment by leilei3915 2 weeks and 4 days ago

Your point of view

You must be signed in to comment.