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.


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.

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

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.
Hide

Tags

Hide

Functions

Commands using dd from sorted by
Terminal - Commands using dd - 141 results
sudo dd if=/dev/sda of=/media/disk/backup/sda.backup
2009-02-27 20:23:37
User: bandit36
Functions: dd sudo
Tags: backup dd
14

This will create an exact duplicate image of your hard drive that you can then restore by simply reversing the "if" & "of" locations.

sudo dd if=/media/disk/backup/sda.backup of=/dev/sda

Alternatively, you can use an SSH connection to do your backups:

dd if=/dev/sda | ssh user@ssh.server.com dd of=~/backup/sda.backup
dd if=10gb of=/dev/zero bs=1M count=10240
2009-02-18 15:30:29
User: logik
Functions: dd
-1

Test your XFS filesystem and Raptor hard drives for write performance.

dd if=/dev/zero of=10gb bs=1M count=10240
2009-02-18 15:29:38
User: logik
Functions: dd
1

Test your XFS filesystem and Raptor hard drives for write performance.

dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev
2009-02-17 23:36:24
User: TyIzaeL
Functions: cut dd rev
0

I know there are a lot of random password generators out there, but I wanted something that put out something besides hex. Set count equal to the number of bytes you want.

dd if=/dev/random of=bigfile bs=1024 count=102400
dd if=/dev/zero of=/swapfile bs=1M count=64; chmod 600 /swapfile; mkswap /swapfile; swapon /swapfile
2009-02-16 18:36:38
User: starchox
Functions: chmod dd mkswap swapon
8

In addition to a swap partition, Linux can also use a swap file. Some programs, like g++, can use huge amounts of virtual memory, requiring the temporary creation of extra space.

dd if=/dev/zero of=/dev/null bs=1M count=32768
2009-02-16 12:22:18
Functions: dd
42

Read 32GB zero's and throw them away.

How fast is your system?

dd bs=1 count=32 if=/dev/random 2> /dev/null | md5 | grep -o '\w*'
dd if="\\?\Device\CdRom0" of=c:\temp\disc1.iso bs=1M --progress
2009-02-13 16:14:50
User: piyo
Functions: dd
-1

dd for windows is available from http://www.chrysocome.net/dd

Tested with CD-ROMs like Linux install discs

I don't know about DVD-ROMs.

dd if=/dev/zero bs=1M | ssh somesite dd of=/dev/null
dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp
2009-02-08 10:10:00
User: morpheus
Functions: dd ssh
178

This will output the sound from your microphone port to the ssh target computer's speaker port. The sound quality is very bad, so you will hear a lot of hissing.

dd if=/dev/sdX of=/root/sdX.bin bs=1M count=1
2009-02-06 17:45:59
User: dhing
Functions: dd
-4

This will copy the first 1MB of your /dev/sdX volume to your /root/sdX.bin file, where SDX is the name of the device you wish to copy the data from (Usually a hard disk)

NOTE: Make sure you capitalize the M in field for BS.

tar -cvzf - /source/path | ssh <targethostname> -l <username> dd of=/destination/path/backupfile.tgz
2009-02-06 15:52:09
User: smm
Functions: dd ssh tar
1

Creates a quick backup with tar to a remote host over ssh.

dd if=/dev/urandom bs=16 count=1 2>/dev/null | base64
2009-02-05 19:19:20
User: twopoint718
Functions: dd
0

Alternatively, if your password can contain a richer character set, try using 'uuencode' rather than base64.

dd if=/dev/urandom bs=16 count=1 2>/dev/null | uuencode -

Sample of that: '0:.CF\-@"\`W315VG^4O\.@``'

dd if=/dev/zero bs=1024 count=1440 > floppy.img && mkdosfs floppy.img
2009-02-05 18:56:55
User: wwest4
Functions: dd mkdosfs
2

mount with:

mount -t msdos -o loop ./floppy.img /tmp/mnt