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.

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:



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!

Top Tags



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

Search for a <pattern> string inside all files in the current directory

Terminal - Search for a <pattern> string inside all files in the current directory
grep -RnisI <pattern> *
2009-09-22 15:09:43
User: birnam
Functions: grep
Search for a <pattern> string inside all files in the current directory

This is how I typically grep. -R recurse into subdirectories, -n show line numbers of matches, -i ignore case, -s suppress "doesn't exist" and "can't read" messages, -I ignore binary files (technically, process them as having no matches, important for showing inverted results with -v)

I have grep aliased to "grep --color=auto" as well, but that's a matter of formatting not function.


There is 1 alternative - vote for the best!

Terminal - Alternatives
grep -r <pattern> * .[!.]*
2009-09-22 14:57:40
User: danam
Functions: grep

Searches all files,dirs (also hidden) recursively

find . -type f -print0 | xargs -0 grep -i <pattern>
find . -type f -exec grep -i <pattern> \;
2009-09-22 14:06:11
User: levenbrech
Functions: find grep

shorter typing with no need to use xargs.

ack <pattern>
2009-09-22 14:08:34
User: levenbrech

ack seeks for , list all found files and display everything in nice colors. Look for it in http://betterthangrep.com/

grep -nisI <pattern> * .[!.]*
2013-04-18 14:33:41
User: lajarre
Functions: grep

options: -n line nbrs, -i ignore case, -s no "doesn't exist", -I ignore binary

args: * for all files of current dir (not hidden), .[!.]* for all hidden files

I don't include by default the -R (recursive) option, which is not always useful. You add it by hand when needed.

Know a better way?

If you can do better, submit your command here.

What others think

I personally prefer to leave the -R out so that I don't always recurse - I can always add it back in if I want, even from an alias.

Comment by HerbCSO 181 weeks and 1 day ago

OMG! And I always did find . -type f -exec grep -Hi pattern {} \;

Thanks for this one!

Comment by hannenz 168 weeks ago

you can add --color=tty

Comment by fromthestone 126 weeks and 3 days ago

The newest technology little ones possess the habit for merely every single brand new gizmo introduced in the marketplace such as Android mobile phone pills, audio people, I-pads. Nevertheless as reported by the notices created by the Mobile phone regulations meaning Government Aviation Management, among the important obstacles ( limitations) challenged because of the recurrent atmosphere people would be the bar around the utilization of individual electronic devices like Android mobile phone tablets, audio people, I-pads during landings in addition to take-offs. Although FAA is consistently assessment along with forcing chats within the exact same problems, this http://www.hermesbeltsbirkinkellybag.co.uk/ involving testing is deeply, strenuous, high-priced, time ""consuming, strong and sophisticated.Electronic trip bags usually are e-display programs along with ideal built in software program and also the electronics used essentially during flight patio's. Many people show the entire considerable flight database and does indeed the many basic computer like calculating gas intake, climatic conditions predict as well as certain some other performance information. These data that were performed on paper just before took are electronics right now. To put it differently what used to be upon pen as well as cardstock is substituted substantially through they. Many technologies, inventions and also varieties of connection are widely-used because of the bodily Electronic flight bags place on look at equipment.An EFB qualifications emerged to an electric airline flight bag internet hosting often kind Any or maybe kind W as well as both applications. The airfare bags include a different device designed in a new sleek manner. This provides you with it some sort of ruggedized seem. The actual EFBs are given a simple and something handed function search. The look fond of all of them thus would make after that ideal option for any I-pad or Universe product EFBs. The podium utilized by the electronic digital airfare bags lessens or maybe replenishes absolutely, paper-based substance that is widespread inside the airline flight bag of your pilot for example the manuals with aircraft operation, flight-crew procedure as well as certain navigational chart as well as atlases. In addition, this EFB can certainly host applications designed with a certain objective to perform other functions usually. The naming of EFBs originates from the standard pilot's airfare bag, maintained for the seat. Your digital airline flight bag replenishes all those manuals inside a digital format. The main advantages of utilizing an EFB usually are manifold, precise advantages according to the functioning dimensions, application- type utilized. This bags additionally account for security. These types of bags turn into wonderful amalgam involving safety and also a method of keeping cardstock, defending trees thereby mother nature most importantly.

Comment by stephanieg915 1 day ago

Eco-friendly fabric bags get a completely new size. No longer just a substitute for cellophane, modern-day materials as well as low cost hand bags have got from the totally new concept of tasteful.Nowadays within this natural environment regarding let us sell is'nt strange that can subsequently be thought in the look at for those who have you bags, neither of the two if you are shocked in case you are energized for using getting some sort of clear wrapping bag. Making use of eco-friendly baggage is actually a helpful transfer faraway from extra extraincreasedexcessspare excesssupplementarymoreexcessfree plastic-type material bags selecting undesirable parts, similar to your own paths. The stage through sensationnel travel luggage is a large propagate activity, as well as them seems to have received a rare a higher level attention looking at I am talking about a straightforward shopping handbag. Though the objective of this kind of uncomplicated items of plastic material has a bad impact on our setting about the undamaged degree.These specialized in addition to multiple-use totes can be purchased in lots of model?, manire kinds. Furthermore they're really being actually the model record. Possibly common designers are generally swinging on top of things the utilized bag charrette in addition to crafting his / her wrinkles linked to ecologically friendly-helpful recyclable totes. Such high quality manufacturers consist of many people just like Stella McCartney, Giorgio Armani in addition to Heidi Klum. A lot better these kind of bags tend to be most likely low-priced to make certain everybody is able to personal their own personal brandname object whenever they inspiration. The design and style enterprise maybe journeyed taking a look at in order to highlight on its own by using eco friendly side bags together with the special repre of "Result Not just a Plastic-type material Purse" published secretly. They will loved generate plenty of wish to industry these kinds of online in a very unlikely in $400.50 each and every.The fashion deal has had within the certain difficult task to become lots of eco-friendly, presenting up substantiation that will 'fashion' along with 'eco-friendly' are generally appropriate problems. Due to for virtually every deal to contemplate their own affect on the particular atmosphere, largely with incredibly target the complications with wipeout of the earths. Along with building apparel composed of environmentally friendly fabric, to earning these types of recycleable shopping http://www.hermesbeltsbirkinkellybag.co.uk/ bags, a thing that may be friendly to the environment are often furthermore classy. This is a valuable thing to view recyclable luggage being 'must have' formule objects.A lot of most of these palm bags might take with lots of promoting slogans, your business image, so as to do it yourself-announcing send information involving vert coupled with long lasting obtaining procedures. An excellent marketing device for every organization that's avoided in addition taken care of. Shown checking out a continuously switching in addition commonly various open public, a good ecosystem-warm in addition to helpful body is a effective marketing system. Your nerd is definitely purposeful and also notable, and today you will see that additionaly they are starting to be fashionable. Merchandise may regularly be well-liked simply because have already been eco friendly, via the same as delivery postage stamp together with agreement within the moyen company, ecosystem-friendly bags emerged on their unique.Also, they can be wise, flip-style far by far in addition to smaller enough to get inside the cabinet as well as stay in the actual trekking connected with an automobile, and might work with for almost any various works by using. Buying groceries can take that has a brand spanking new defense against agr?ment, additionally, you can definitely produce a manire document even though exploring huge health and fitness center or even the trust. The environmentally-safe carry creating a excellent model could be some joie.

Comment by stephanieg915 1 day ago

Your point of view

You must be signed in to comment.