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.

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:



2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.




Cloning hard disks over the network:

Terminal - Cloning hard disks over the network:
Boot up destination machine with Knoppix live CD and run nc -l -p 9000 | dd of=/dev/sda Then on the master dd if=/dev/sda | nc <dest-ip> 9000 You can monitor bandwidth usage to see progress: nload eth0 -u M
2009-05-07 05:26:58
User: lv4tech
Functions: dd
Cloning hard disks over the network:

This is a bit to bit copy so if you have a 500GB hard disk it will take a long time even if have Gigabit Ethernet


There are 2 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

Besides the fact this is bad formatted, you forgot to advise if the hard disk contains an OS, both computers must have the same hardware configuration. Also, you need to Ctrl-C to ends nc (just for the master machine because the destination one finishes by itself after that). Although I think "why do you need a dd copy of an entire hard disk drive just for your regular files?" An scp would be better.

You might suggest a use, like some corporation which has a lot of the same manufactered computers

and need to them running the same OS configuration. However, better cloning just the interest

partitions (and restoring the MBR with GRUB, for example).

That's more useful if you run a NIS service on your server and the clients share accounts with it.

One more comment. You can use the -vv (verbose) flag for nc and track when the copy ends.

P.S.: I don't know Knoppix, but with the Ubuntu LiveCD you must need to be root (sudo doesn't work).

Comment by cammarin 307 weeks and 3 days ago

Having 2 identical machines and wanting to have a hot spare in case something goes wrong with the primary, just switch an internal ip and you are back up and running in a matter of minutes. I think of it like windows system restore, this is done weekly with no downtime for the live machine. If you know a better way of achiving this please do let me know

Comment by lv4tech 307 weeks and 2 days ago

Or you could use the network block driver maybe....

Comment by DaveQB 307 weeks and 2 days ago

Your point of view

You must be signed in to comment.