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.


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

Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Counting the source code's line numbers C/C++ Java

Terminal - Counting the source code's line numbers C/C++ Java
find /usr/include/ -name '*.[c|h]pp' -o -name '*.[ch]' -exec cat {} \;|wc -l
2011-12-01 19:58:52
User: kerim
Functions: cat find wc
-4
Counting the source code's line numbers C/C++ Java

Count your source and header file's line numbers

For example for java change the command like this

find . -name '*.java' -exec cat {} \;|wc -l

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives
find /usr/include/ -name '*.[c|h]pp' -o -name '*.[ch]' -print0 | xargs -0 cat | grep -v "^ *$" | grep -v "^ *//" | grep -v "^ */\*.*\*/" | wc -l
2013-06-17 08:37:37
Functions: cat find grep wc xargs
1

Count your source and header file's line numbers. This ignores blank lines, C++ style comments, single line C style comments.

This will not ignore blank lines with tabs or multiline C style comments.

find /usr/include/ -name '*.[c|h]pp' -o -name '*.[ch]' -print0 | xargs -0 wc -l | tail -1

Know a better way?

If you can do better, submit your command here.

What others think

The cat is unnecessary. You can just use something like this:

find . -name '*.java' | xargs wc -l
Comment by sharfah 261 weeks and 1 day ago

This approach is not the best one: it also counts blank lines and comments. Better use a dedicated tool to count lines, e.g. CLOC, loc, or similar.

Comment by mackaz 261 weeks and 1 day ago

Also

find . -name *.java -print0 | wc -l --files0-from -
Comment by johnquail 253 weeks and 6 days ago

chanyuan0902

http://www.raybansunglass.com.au

http://www.outletlongchamp.in.net

http://www.burberry-outletstore.in.net

http://www.lebronjamesshoes.in.net

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

http://www.louisvuittonhandbagsoutlet.org.uk

http://www.michaelkorsoutletonline-store.us.com

http://www.tory-burchoutlet.us.org

http://www.vans-shoes.cc

http://www.uggsale.me.uk

http://www.christianlouboutinscheap.us

http://www.michaelkorsoutletclearanceonline.in.net

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

http://www.beatsbydrdre-headphones.us.com

http://www.adidasukstore.org.uk

http://www.ralphlauren-outletuk.co.uk

http://www.truereligionjeanssale.in.net

http://www.asicsisrael.com

http://www.long-champoutlet.us.com

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

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

http://www.fitflopsshoes.co.uk

http://www.raybansun-glassessale.us.com

http://www.mulberry-handbagsoutlet.org.uk

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

http://www.pradahandbags.org.uk

http://www.airjordan4.org

http://www.tiffany-jewelry.com.co

http://www.sac-louisvuittonpascher.fr

http://www.hollisteruksale.co.uk

http://www.rolexoutlet.us.com

http://www.chicagoblackhawks.us.com

http://www.lebronjames.us.com

http://www.lululemonoutletonline.in.net

http://www.michaelkorshandbagsoutletclearance.us.com

http://www.lululemonoutletonline.us.com

http://mulberryoutlet.outlet-store.co.uk

http://www.outletmulberry.org.uk

http://www.cheapfootballshirt.org.uk

http://www.hollisterclothingstore.in.net

http://www.uggsoutletstore.in.net

http://www.futbol-baratas.com

http://www.cheap-uggsoutlet.in.net

http://www.uggbootsoutlet.me.uk

http://www.mizunorunningshoes.us

http://www.michaelkorshand-bagsoutlet.us.com

http://www.pandora.eu.com

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

http://www.louisvuittonoutlet-clearance.us.com

http://www.coachoutletcanada.com.co

http://www.kobeshoes.us

http://www.cartier-watches.us.com

http://www.michaelkorswallet.net

http://www.michaelkorsfactoryoutletstore.in.net

http://www.polooutletstore.us.com

http://www.jordanshoes.us.com

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

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

http://www.polooutletstore.us.com

http://www.swarovskicrystal.in.net

http://www.coachoutletonline-stores.us.com

http://www.canadagoose-outletstore.com

http://www.truereligionjeansoutlets.us.com

http://www.cheapuggoutlet.in.net

http://www.rayban-sunglassessale.us.com

http://www.michaelkorshandbagsonsale.in.net

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

http://www.cheapoakleysunglasses-wholesale.us.com

http://www.kobe9elite.us.com

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

http://www.pololacostepascher.fr

http://www.michaelkorshandbagsoutletfactory.in.net

http://www.nfljerseys-wholesale.us.com

http://www.outletswarovski.co.uk

http://www.truereligion-sale.in.net

http://www.bootsugg.co.uk

http://www.niketnpascher.fr

http://www.watchescartier.us.com

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

http://www.coachoutlet-onlinestore.com.co

http://www.poloralph-lauren.us.com

http://www.tomsshoes.me.uk

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

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

http://www.michaelkorsoutlet-uk.me.uk

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

http://www.rolexwatchesoutlet.us.com

http://www.lululemonoutlet.org.uk

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

http://www.swarovskicrystal.me.uk

http://www.moncleroutletstore.us.com

http://www.swarovskicrystal.us.com

http://www.chromeheartsoutlet.us

http://www.coachoutletstore.com.co

http://www.hollisterclothing.co.uk

http://www.tiffanyjewelryoutlet.us

http://www.chromeheartssunglasses.us

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

http://www.michaelkorshandbagsoutlet-factory.us.com

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

http://www.tiffanyjewellery-outlet.co.uk

http://www.louisvuittonreplica.us.com

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

http://www.louisvuitton-handbags.co.uk

http://www.linksoflondons.co.uk

http://www.nikerosherun.me.uk

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

http://www.poloralph-laurenoutlet.us.com

http://www.louisvuittonhandbagssale.us.com

http://www.foampositeshoe.net

http://www.katespade.org.uk

http://www.coachoutletonline-factory.us.com

http://www.truereligionoutlet-store.us.com

http://www.outletmichaelkors.co.uk

http://www.christianlouboutinonline.us.com

http://www.nikerosherunshoes.org.uk

http://www.edhardy.us.com

http://www.longchamppas-cher.fr

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

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

http://www.fitflopssale.us

http://www.christianlouboutinscheap.us

http://www.iphonecase.me.uk

http://www.michaelkorsoutletclearancesale.us.com

http://www.tiffanyjewelryoutlet.in.net

http://www.rolexreplicawatches.com.co

http://www.wholesale-nbajerseys.com

http://www.michaelkorshandbagson-sale.us.com

http://www.longchamphand-bags.us.com

http://www.fitflopssaleclearance.in.net

http://www.louboutinpas-cher.fr

http://www.michaelkorsoutletonlinestores.us.com

http://www.calvin-klein.in.net

http://www.nikeairmax90.co.uk

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

http://www.ghdstraighteners.org.uk

http://www.coachoutletclearancesale.com.co

http://www.monclerjacketsuk.co.uk

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

http://www.poloralph-laurenoutlet.us.com

http://www.cheapraybansun-glasses.us.com

http://www.toryburchoutletsonline.in.net

http://www.nike-mercurial.net

http://www.raybansunglasses-wholesale.us.com

http://www.michaelkors-outletclearance.com.co

http://www.nikestore-uk.me.uk

http://www.louisvuittonoutlet-stores.us.org

http://www.ralphlauren-pascher.fr

http://www.thomassabo.me.uk

http://www.uggs-outlet.eu.com

http://www.saclongchamp-pliage.fr

http://www.michaelkorsoutletstoreonlineclearance.us.com

http://www.toms.us.com

http://www.michaelkorsusa.us

http://www.hermesbelts.us

http://www.salvatore-ferragamo.in.net

http://www.cheapuggbootsforsale.in.net

http://www.longchamp-solde.fr

http://www.pumaoutletonline.com

http://www.nikefreerun5.co.uk

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

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

http://www.michaelkorsfactoryoutlet.us.org

http://www.mbtshoesoutlet.us.com

http://www.coachoutletclearancesale.us.com

http://www.diorsunglasses.com.co

http://www.reebokoutletstore.us.com

http://www.louisvuittonsunglasses.us.com

http://www.celineoutletus.com

http://www.uggbootsuk.org.uk

http://www.longchamphandbags.org.uk

http://www.cheap-nikeshoes.cc

http://www.coachoutletstores.com.co

http://www.versacesunglasses.com.co

http://www.suprashoes.us.com

http://www.pandorajewelryoutlet.us.com

http://www.ralphlaurenpas-cher.fr

http://www.nike-airmax2015.us

http://www.adidasnmdshoes.us.org

http://www.michaelkorsoutletonline.in.net

http://www.hollistershirts.me.uk

http://www.adidas-wings.in.net

http://www.cheapmichaelkorshandbag.in.net

http://www.ferragamo.eu.com

http://www.airmax90.org.uk

http://www.oakleysunglassess.co.uk

http://www.hermesoutletstore.us.com

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

http://www.christianlouboutin-outlet.me.uk

http://www.giuseppe-zanotti-outlet.org

http://www.coachoutletonlinesale.com.co

http://www.cheapmlbjerseys.net

http://www.adidasukstore.org.uk

http://www.sunglassesrayban.org.uk

http://www.nikeblazerpas-cher.fr

http://www.canadagooseoutlet-store.com

http://www.mulberrysale.co.uk

http://www.maccosmetics.in.net

http://www.raybanssunglassescheap.us.com

http://www.louisvuittonoutletlv.us.com

http://www.ralphlaurenoutlet.org.uk

http://www.coachhandbagsclearance.us.com

http://www.louis-vuittonlv.us.com

http://www.ralph-lauren.us.org

http://www.outletmichaelkors.org.uk

http://www.uggboot.com.co

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

http://www.outletchristianlouboutin.us.com

http://www.coachoutletclearanceonline.us.com

http://www.truereligionjeans-canada.com

http://www.nikeoutletstore.us

http://www.mulberryhandbagssale.co.uk

http://www.rolex-watches.it

http://www.airhuarache-nike.co.uk

http://www.ralphlauren-polo.us.com

http://www.air-jordanshoes.us.com

http://www.michaelkorsoutletonline-clearance.us.com

http://www.omegawatches.me.uk

http://www.truereligion-jean.us.com

http://www.thenorth-facejackets.us.com

http://www.replicawatchesfor-sale.us.com

http://www.cheapmlbjerseys.us.com

http://www.nikeairmax90.me.uk

http://www.ugg-bootsclearance.in.net

http://www.michaelkorsoutletcanada.in.net

http://www.hollisteruksale.co.uk

http://www.cheapuggbootsoutlet.in.net

http://www.michaelkorsoutletsclearance.us.com

http://www.ralphlaurenpas-cher.fr

http://www.louis-vuitton.us.com

http://www.coachoutletclearance.us.com

http://www.cheap-michaelkorshandbags.in.net

http://www.tommyhilfiger.org.uk

http://www.michaelkorsoutlet-store.us.com

http://www.salomonshoes.us.com

http://www.cazal.us.com

http://www.uggoutletuk.org.uk

http://www.uggboots-clearance.in.net

http://www.ugg-outlet.me.uk

http://www.poloralph-lauren.org.uk

http://www.michaelkorsuk-outlet.org.uk

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

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

http://www.michaelkorsoutlet-factory.us.com

http://www.ralphlaurenpoloshirts.org.uk

http://www.michaelkorsfactoryoutletstore.us.com

http://www.juicycoutureoutlet.net

http://www.bottega-venetaoutlet.net

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

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

http://www.nikeairmaxshoess.co.uk

http://www.michael-korsoutletonline.in.net

http://www.cartierwatches.org.uk

http://www.michaelkorsoutletstoreonline.in.net

http://www.beatsheadphones.org.uk

http://www.swarovskicrystals.com.co

http://www.rolexwatches.in.net

http://www.mont-blancpens.com.co

http://www.michaelkorsfactoryoutletclearance.us.com

http://www.michaelkorshandbag.in.net

http://www.adidasnmd.me.uk

http://www.cartier.us.com

http://www.airjordan11.net

http://www.coachoutletonlineclearance.com.co

http://www.nhljerseys-wholesale.us.com

http://www.beats-headphones.in.net

http://www.jordan-pascher.fr

http://www.truereligion.org.uk

http://www.valentinooutlet.us.com

http://www.the-northfacejacket.us.com

http://www.herveleger.us.com

http://www.katespadeuk.org.uk

http://www.louisvuitton-handbags.me.uk

http://www.fitflop.in.net

http://www.canadagoose-jackets.com.co

http://www.nikefreerun5.co.uk

http://www.michaelkorsoutletonlinestore.in.net

http://www.timberlandboots.name

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

http://www.louisvuittonoutlet-stores.us.com

http://www.truereligionjeanssale.com

http://www.ugg-bootscheap.in.net

http://www.rayban--sunglasses.me.uk

http://www.oakleysunglasseswhole-sale.us.com

http://www.burberrysaleoutlet.us.com

http://www.tomsshoes.in.net

http://www.cheapuggboots.net.co

http://www.ralphlauren-polo.in.net

http://www.ray-bansunglassescheap.us.com

http://www.beatsbydrdre.co.uk

http://www.michaelkorshandbagsoutlet.us.org

http://www.christianlouboutin-shoes.org.uk

http://www.abercrombie-fitch-hollister.fr

http://www.uggboots-outlet.org.uk

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

http://www.toryburchhandbags.us.com

http://www.uggbootsclearancesale.in.net

http://www.coachoutletonlinestore.com.co

http://www.canada-goose.com.co

http://www.truereligionoutlet.org.uk

http://www.louisvuittonhand-bags.us.org

http://www.airforce1.us.com

http://www.uggsonsale.in.net

http://www.louisvuitton--handbags.us.com

http://www.adidastrainers.me.uk

http://www.mulberryhandbags.org.uk

http://www.coachoutletonline-store.com.co

http://www.fitflopsoutletsale.com

http://www.coachoutlethandbags.us.com

http://www.fitflopssale.in.net

http://www.coachoutletfactory-store.us.com

http://www.rolex-watches.it

http://www.louisvuittonhandbags.me.uk

http://www.airjordan13s.com

http://www.hermesbirkin.org

http://www.chaussurelouboutin.fr

http://www.coachoutletonlineshopping.us.com

http://www.fredperrypoloshirts.com

http://www.raybansun-glassessale.us.com

http://www.clearancefitflopssale.com

http://www.handbagslongchamp.us.com

http://www.moncler.us.com

http://www.longchamphandbags.org.uk

http://www.louis-vuittonoutletstore.us.com

http://www.swarovski.in.net

http://www.rolexwatchesforsale.me.uk

http://www.ferragamoshoes.org.uk

http://www.louis-vuittonhandbag.us

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

http://www.toryburch-outletstore.in.net

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

http://www.pradashoes.us

http://www.uggboots-outlet.me.uk

http://www.ysloutletonline.com

http://www.truereligionjeansoutlet.co.uk

http://www.tiffanyjewellery.org.uk

http://www.longchampoutlet.us.com

http://www.rolexwatchesforsale.in.net

http://www.ferragamoshoesoutlet.net

http://www.uggoutletstoreshoes.in.net

http://www.longchampbag.org.uk

http://www.uggsoutlet.me.uk

http://www.michaelkorshandbagsclearance.in.net

http://www.nikefree5.us

http://www.louisvuitton-neverfull.us.com

http://www.michaelkorshandbags.in.net

http://www.longchamppliage.fr

http://www.michaelkorsoutletonline-sale.com.co

http://www.ferragamoshoes.com.co

http://www.cheapreplicawatches.com.co

http://www.newbalanceshoes.in.net

http://www.fitflopssale.me.uk

http://www.michaelkorsclearance.in.net

http://www.ralphlaurenpolo.com.co

http://www.coachoutletonlinesale.us

http://www.uggboots-onsale.in.net

http://www.uggs-outlet.de.com

http://www.toryburchoutlet-online.us.com

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

http://www.adidasoutletstore.in.net

http://www.fitflopsshoes.in.net

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

http://www.raybansun-glassess.us.com

http://www.niketrainers.me.uk

http://www.instylerionicstyler.com

http://www.marc-jacobs.us.org

http://www.michaelkorsoutletclearancesale.in.net

http://www.cheapuggaustralia.in.net

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

http://www.toryburch.com.co

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

http://www.nikefreerun5.org.uk

http://www.montblancpenss.us.com

http://www.canadagoose-jackets.me.uk

http://www.cheapsoccerjersey.net

http://www.basketballshoes.us.com

http://www.mulberry-handbags.co.uk

http://www.outlettruereligion.in.net

http://www.canadagoosejackets.eu.com

http://www.burberryoutletstore.in.net

http://www.ugg-slippers.com.co

http://www.coachoutletclearanceonline.com.co

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

http://www.soccerjerseys.us.com

http://www.hollistercanada.com

http://www.ralphlaurenpolo.us.com

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

http://www.converseshoes.us.com

http://www.coachoutletstoreclearance.us.com

http://www.michaelkorsfactoryoutletonline.in.net

http://www.nike-outletonline.com

http://www.pradasunglasses.us.com

http://www.ralphlauren-polo.it

http://www.hollister-clothingstore.net

http://www.tiffanyandco.me.uk

http://www.longchamphandbag.co.uk

http://www.nikeoutletstores.us

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

http://www.uggson-sale.in.net

http://www.pradaoutlet.us

http://www.mulberry-bags.co.uk

http://www.nikeair-huarache.org.uk

http://www.oakleysun-glassescheap.us.com

http://www.lacostepoloshirts.cc

http://www.jeanstruereligion.in.net

http://www.airmax90.us.com

http://www.abercrombiefitch-hollister.es

http://www.cartierwatches.org.uk

http://www.ralphlauren-polo.org.uk

http://www.truereligionjeans.org.uk

http://www.michaelkorsbags.org.uk

http://www.michaelkorsoutlet-clearance.com.co

http://www.adidasyeezyboost350.us.com

http://www.reeboktrainers.org.uk

http://www.michael-korsoutletclearance.com.co

http://www.raybanssun-glasses.us.com

http://www.ferragamooutletstore.net

http://www.uggoutletonline.com.co

http://www.oakleysunglasses.org.uk

http://www.cheapnfljerseys.org

http://www.storecoachoutlet.us.com

http://www.kobebryantshoes.in.net

http://www.uggoutletonlinestore.in.net

http://www.nikeairforce1.fr

http://www.louis-vuittonpascher.fr

http://www.louis-vuittonpascher.fr

http://www.cheapoakley-sunglasseswholesale.us.com

Comment by chanyuan 13 weeks and 1 day ago

Your point of view

You must be signed in to comment.