« Hidden Linux : Example commands - dd (Part I) | Main | How to: Install Linux without a CD-Rom »


Last time I covered the basic use of dd, Linux's "Convert and copy a file" command. Here are a few more things you can do with it, some trivial, some useful.



File Conversion
Convert a file to uppercase:
dd if=filename of=filename conv=ucase

Convert a file to lowercase:
dd if=filename of=filename conv=lcase

(Incidentally, if you leave out of= output gets written to "standard output" -- which defaults to the screen.)



File rescue
If a video or sound clip won't play because of bad blocks, copy it, telling dd to ignore the corrupt stuff
dd if=badfile.wav of=fixedfile.wav conv=noerror



Wipe all the free space on a partition
(ie: Deleted files you don't want recovered)
dd if=/dev/urandom of=~/trash.file
This will create a file called trash.file on your home partition and fill it with random characters. Eventually dd wil stop with the message No room left on device meaning all free space has been consumed. Then simply delete trash.file with:
rm trash.file

Note that dd only overwrites, it doesn't provide a cryptographic deletion. For that you're better off with srm and sfill. (See here.)



Look at your disk
If you have the program hexdump installed (it's available in most standard repositories), you can check out the contents of your hard drive.

Look at the first sector on your hard drive:
dd if=/dev/sda count=1 | hexdump -C
dd defaults to a byte count (bs=) of 512, so this will show the first 512 bytes on your disk. (The first 446 are the MBR, the remainder are the partition table.)




Previous Hidden Linux
Next Hidden Linux



Follow Geoff Palmer on Twitter

Comments

I made a visit to this blog, I was very pleased with what I saw, are usefully informative and meaningful for the blogger feel good to visit this blog, keep it performing this work will make sure that as much success with these ideas well developed. thanks

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Subscribe
Newsletter & SubscriptionsPC World is New Zealand’s top selling computing and technology magazine.

It provides up-to-the-minute editorial, insight and buying advice for personal computing, cell phones, game consoles, digital entertainment and broadband.
SIGN UP
PCWorldUpdate
PC World's weekly round-up of tech news, gear and game reviews, software selections, and handy How Tos.