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

Duplicate a directory tree using tar and pipes

Terminal - Duplicate a directory tree using tar and pipes
(cd /source/dir ; tar cvf - .)|(cd /dest/dir ; tar xvpf -)
2009-07-14 20:03:23
User: tkunz
Functions: cd tar
-3
Duplicate a directory tree using tar and pipes

Alternatives

There are 4 alternatives - vote for the best!

Terminal - Alternatives
tar cpof - src |( cd des; tar xpof -)
2009-09-20 20:43:30
Functions: cd tar
-2

Using tape archive create a tar file in Stdout (-) and pipe that into a compound command to extract the tar file from Stdin at the destination. This similar to "Copy via tar pipe ...", but copies across file systems boundaries. I prefer to use cp -pr for copying within the same file system.

(cd /source/dir ; tar cv .)|(cd /dest/dir ; tar xv)
2009-07-19 10:31:13
User: marssi
Functions: cd tar
-11

the f is for file and - stdout, This way little shorter.

I Like copy-directory function It does the job but looks like SH**, and this doesn't understand folders with whitespaces and can only handle full path, but otherwise fine,

function copy-directory () { ; FrDir="$(echo $1 | sed 's:/: :g' | awk '/ / {print $NF}')" ; SiZe="$(du -sb $1 | awk '{print $1}')" ; (cd $1 ; cd .. ; tar c $FrDir/ )|pv -s $SiZe|(cd $2 ; tar x ) ; }

Know a better way?

If you can do better, submit your command here.

What others think

Browse through company connected with high-end Resort Toiletries for prime quality merchandise. Being a Resort House shoes composed of washroom, area in addition to connected accommodations merchandise numerous through cleaning add-ons in order to bags shelving & golf carts.The web page is quite high quality along with completely sets itself apart amongst the countless kinds of bags made available available for purchase. For example, an obvious improvement in involving the make bags, throw bags and spending budgets, and many others is performed. Bags with top rated deals with plus the exclusive trend pattern software choices are undoubtedly distributed. Identical are likewise made of the actual bags designed to carry luggage. Many designs and patterns are around every corner for that consumers to choose from. The web page has particular photos with the bags in order for the end users can easily easily determine precisely what to merely possess from all of these people.Well, there's 2 multiple LV companies and also customers that have demonstrated their selves, on the time period together with a collection lot of productive revenue regarding authentic merchandise, and that possess a change paid by one of two "physiques".Mending: Please remember restoring your bag, even when it can be since slight while altering the particular zippers can be pricey in addition to cumbersome. You'll be able to take your genuine bag to some look for fixes. This will likely certainly acquire many techniques from weekly a number of weeks for the complexed the actual fixes expected will be as along with various different fixes employment likely performing at present. The actual restoration cost ranges however to have a thought of the repair bills, have faith in relation to having to pay near to one hundred money to solve the lining in a wallet. Therefore, i suggest you go through the mantra associated with 'deterrence is way better than treatment' as well as carry beneficial treating your own bag from the start.In the original meet with on the stock market, Toledano defined yesterday in which Zentai would probably never end way up as a replicate regarding Dior, LVMH's 2nd most significant fashion brand immediately after store.Last nevertheless definitely not the least inside our checklist, Rob Lauren can be a developer connected with bags through the area for its preppy, elegant, along with http://www.hermesbeltsbirkinkellybag.co.uk/ cool types. The most up-to-date number of Rob Lauren is something many enthusiasts of custom made handbags usually droll in excess of.That combined "F" logo design won't be missed out on with any type of collection of developer bag buffs. While using Fendi clutch i465 or wallet, any person will certainly search delightful and delicate.Some experts even now question regardless of whether LVMH, inside mania involving winning prize buying inside late 1990's, paid a significant amount of with regard to Zentai in addition to ponder what sort of small business will certainly recover the investment.

Comment by stephanieg915 11 hours ago

Your point of view

You must be signed in to comment.