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

Lines per second in a log file

Terminal - Lines per second in a log file
tail -n0 -f access.log>/tmp/tmp.log & sleep 10; kill $! ; wc -l /tmp/tmp.log
2010-04-29 21:23:46
User: dooblem
Functions: kill sleep tail wc
1
Lines per second in a log file

Another way of counting the line output of tail over 10s not requiring pv.

Cut to have the average per second rate :

tail -n0 -f access.log>/tmp/tmp.log & sleep 10; kill $! ; wc -l /tmp/tmp.log | cut -c-2

You can also enclose it in a loop and send stderr to /dev/null :

while true; do tail -n0 -f access.log>/tmp/tmp.log & sleep 2; kill $! ; wc -l /tmp/tmp.log | cut -c-2; done 2>/dev/null

Alternatives

There are 8 alternatives - vote for the best!

Terminal - Alternatives
tail -f access.log | pv -l -i10 -r >/dev/null
2010-04-29 21:02:01
User: dooblem
Functions: tail
Tags: tail pv
8

Displays the realtime line output rate of a logfile.

-l tels pv to count lines

-i to refresh every 10 seconds

-l option is not in old versions of pv. If the remote system has an old pv version:

ssh tail -f /var/log/apache2/access.log | pv -l -i10 -r >/dev/null

grep <something> logfile | cut -c2-18 | uniq -c
2010-04-29 11:26:09
User: buzzy
Functions: cut grep uniq
Tags: uniq grep cut
5

The cut should match the relevant timestamp part of the logfile, the uniq will count the number of occurrences during this time interval.

tail -f /var/log/logfile|perl -e 'while (<>) {$l++;if (time > $e) {$e=time;print "$l\n";$l=0}}'
2011-06-21 10:28:26
User: madsen
Functions: perl tail time
Tags: perl tail
3

Using tail to follow and standard perl to count and print the lps when lines are written to the logfile.

tail -F some.log | perl -ne 'print time(), "\n";' | uniq -c
tail -F /var/log/nginx/access.log | python -c 'exec("import sys,time\nl=0\ne=int(time.time())\nfor line in sys.stdin:\n\tt = int(time.time())\n\tl += 1\n\tif t > e:\n\t\te = t\n\t\tprint l\n\t\tl = 0")'
2012-05-15 21:56:46
User: pykler
Functions: python tail
0

Realtime lines per second in a log file using python ... identical to perl version, except python is much better :)

Know a better way?

If you can do better, submit your command here.

What others think

Because the craze of obtaining factor making use of internet retailers is definitely acquiring upward popularity, there are various details you ought to think about to create your web order an advantageous experience. For selecting makes like Levis, as well as BCBG footwears on the web consistently consider some of the customers that have utilized the stores intend to ensure that concerning the excellent of shoes you can buy and steer clear of by yourself from dropping victim to be able to sham traders. It is additionally recommended that you check out client opinions in regards to the outlet to accumulate knowledge for the remedies they make, monitoring treatments in addition to their buyer support.If that isn't ample to receive you to buy on the internet, consider the cost cost savings. Retailers on the net could possibly source their own watches on large price tag reductions over the retailers on the mall because of very low cost to do business. They just don't have to pay lease fees, efforts expenses, personnel, plus much more. Their personal savings they sometimes pass on for their customers, which may help save large sums of money when you are reflecting through to obtain a expensive elegant gemstone watch.Initially beginning from his own apparel collection, they soon turned out to be a name for you to reckon within the trend small business. A lot of the significant list garments shops world-wide starting outfitting their outfits range for female and so the appeal broadened. Ladies all over the earth appreciated just how their apparel could match themselves and soon he / she became a lover foundation that will featured some of the most crucial superstars on the globe.Now, everything you require is capture this contemporary location, and pick the fashion development bags. Scientific research as well as technology advances additionally participate in a crucial perform within our socialist structure. Out of the box essential, you may need this specific Carriers to indicate ones contemporary fashion development. And you'll certainly lack of feeling to be able to feel dissapointed about to be, because of the fact that is certainly sensation problems returning to the form time. Usually do not loaf around any more.Boat vacation outlines include duty-free searching though the smart female associated with scent nosing about the boat excursion shop cologne counter-top may well notice that rates on the colognes on board deliver will not be a whole lot unique of costs at home in the state wall plug shop as well as web store. Thus precisely exactly what is the massive offer you regarding duty-free at any rate?Alexandra Schulman, writer on the Uk sort of Fashion Newspaper, held an evening meal with the Coffee shop Royal london, Great britain in Friday, April Twenty-five, The year 2013, to recognition Outlet Keep.Bleecker Avenue is actually house to many of fashion trend's primary product labels * Marc Jacobs, Ron Lauren, Lulu Guinness. This particular December, will definitely include his / her label towards the well-liked West Group remove as stated by simply WWD on the net. Kors definitely will always be opening a single,475 square-foot lifestyle dress shop including extras as well as other solutions from your manufacturer. The particular dress retail outlet definitely will be located from Olive & & Bette's prior region on 384 Bleecker Road.It does work that the tie selection tends to make or breaks a dressing up. You can find neckties that match properly using a wide range of outfits. Below I supply an accessibility of the very best contacts dollars can get, these are some of the finest neckties readily accessible in the united states therefore you need not worry about definitely not purchasing 1 from your community style shop because they're easily available on the http://www.hermesbeltsbirkinkellybag.co.uk/ net.

Comment by stephanieg915 4 days ago

www.canadagoosefemmehomme2016.fr/canada-canada-goose_246.html

www.canadagoosefemmehomme2016.fr/homme-canadian-goose_180.html

www.canadagoosefemmehomme2016.fr/canada-goose-pas-cher-paris_354.html

www.canadagoosefemmehomme2016.fr/blouson-canada-goose-homme_467.html

www.canadagoosefemmehomme2016.fr/canada-goose-kensington_86.html

www.canadagoosefemmehomme2016.fr/canada-goose-bleu-electrique_187.html

www.canadagoosefemmehomme2016.fr/vente-doudoune-canada-goose-femme_197.html

www.canadagoosefemmehomme2016.fr/canada-goose-parka-chateau_427.html

www.canadagoosefemmehomme2016.fr/parka-citadel-canada-goose_253.html

www.canadagoosefemmehomme2016.fr/canada-goose-mountaineer_477.html

www.canadagoosefemmehomme2016.fr/entrepot-canada-goose_158.html

www.canadagoosefemmehomme2016.fr/forum-canada-goose_60.html

www.canadagoosefemmehomme2016.fr/canada-goose-hybridge_344.html

www.canadagoosefemmehomme2016.fr/manteau-femme-canada-goose_248.html

www.canadagoosefemmehomme2016.fr/boutique-canada-goose-montreal_456.html

www.canadagoosefemmehomme2016.fr/canada-goose-quebec_125.html

www.canadagoosefemmehomme2016.fr/canada-goose-destockage_165.html

www.canadagoosefemmehomme2016.fr/canada-goose-montreal_267.html

www.canadagoosefemmehomme2016.fr/site-officiel-canada-goose_432.html

www.canadagoosefemmehomme2016.fr/trillium-parka-canada-goose_108.html

www.canadagoosefemmehomme2016.fr/gilets-canada-goose_370.html

www.canadagoosefemmehomme2016.fr/mystique-parka-canada-goose_229.html

www.canadagoosefemmehomme2016.fr/comment-reconnaitre-une-canada-goose_478.html

Comment by sguerra376 1 day ago

www.canadagoosefemmehomme2016.fr/canada-goose-logo_212.html

www.canadagoosefemmehomme2016.fr/canada-goose-entrepot_141.html

www.canadagoosefemmehomme2016.fr/goose-canada-femme_476.html

www.canadagoosefemmehomme2016.fr/canada-goose-hybridge-hoody_382.html

www.canadagoosefemmehomme2016.fr/canada-goose-chateau-pas-cher_173.html

www.canadagoosefemmehomme2016.fr/canada-goose-chilliwak_109.html

www.canadagoosefemmehomme2016.fr/nouvelle-collection-canada-goose_451.html

www.canadagoosefemmehomme2016.fr/canada-goose-parka_61.html

www.canadagoosefemmehomme2016.fr/veste-de-ski-canada-goose_162.html

www.canadagoosefemmehomme2016.fr/canada-goose-femme-chilliwack_113.html

www.canadagoosefemmehomme2016.fr/canada-goose-violette_121.html

www.canadagoosefemmehomme2016.fr/canada-goose-femme-pas-cher_139.html

www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-occasion_150.html

www.canadagoosefemmehomme2016.fr/branta-canada-goose_271.html

www.canadagoosefemmehomme2016.fr/canada-goose-modele-victoria_409.html

www.canadagoosefemmehomme2016.fr/canada-goose-site-fiable_136.html

www.canadagoosefemmehomme2016.fr/canada-goose-bleu-marine_235.html

www.canadagoosefemmehomme2016.fr/point-de-vente-canada-goose_304.html

www.canadagoosefemmehomme2016.fr/canada-goose-pas-cher-france_142.html

www.canadagoosefemmehomme2016.fr/canada-goose-banff_129.html

www.canadagoosefemmehomme2016.fr/canada-goose-doudoune_163.html

www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-chilliwack-femme_473.html

Comment by sguerra376 23 hours ago

http://www.canadagoosefemmehomme2016.fr/ecusson-canada-goose_168.html

http://www.canadagoosefemmehomme2016.fr/manteau-canada-goose-a-vendre_450.html

http://www.canadagoosefemmehomme2016.fr/rideau-canada-goose_303.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-milan_99.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-chilliwack-bomber-femme_458.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-borden-bomber_196.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-chilliwack-homme_298.html

http://www.canadagoosefemmehomme2016.fr/blouson-goose-canada_195.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-homme-pas-cher_440.html

http://www.canadagoosefemmehomme2016.fr/kensington-parka-canada-goose_257.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-femme-victoria_285.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-yorkville-bomber_408.html

http://www.canadagoosefemmehomme2016.fr/vetements-canada-goose_64.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-champs-elysees_360.html

http://www.canadagoosefemmehomme2016.fr/montebello-canada-goose_148.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-new-york-price_202.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-chateau_300.html

http://www.canadagoosefemmehomme2016.fr/goose-canada-femme_476.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-prix_56.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-inc_430.html

http://www.canadagoosefemmehomme2016.fr/canada-goose-bleu-marine_235.html

http://www.canadagoosefemmehomme2016.fr/doudoune-canada-goose-pour-femme_475.html

Comment by sguerra376 11 hours ago

Your point of view

You must be signed in to comment.