World is Welcome To The World of Linux

Journey into the world of linux

Menu
  • About
  • Welcome
Menu

The dd Command FAQs

Posted on April 2, 2009 by Ganesh Sharma

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Whosoever has worked in Unix environment must be aware of dd command. The specialty of dd command lies in fact that it can copy a file, convert character mapping of files and do various other operations. In this article I am going to introduce various uses of dd command in the form of FAQs. Although the options apply to all *nix based OS, but these are specifically related to AIX.

What Does dd Command Do
The dd command reads input file specified by “if” parameter and produces output file specified by “of” parameter. In the process of generating output file, it can take  several other parameters to fulfill the demands of output file. One more specific thing about dd is that, it copies the files block by block. Default block size is taken as OS block size.

What Are dd Command Common Parameters
The dd command has the following common parameters:

1. bs:                Block Size.
2. cbs:              Conversion Block Size. Used if block, unblock, ascii, ebcdic or ibm conversion is used. Its used for converting from variable block size devices to fixed block size devices.
3. conv:           Conversion format. It can be [ascii | block | ebcdic | ibm | unblock], [lcase |  ucase], [iblock],  [noerror], [swab], [sync], [oblock], [notrunc].
4. count:          Number of input blocks.
5. files:                        Input files.
6. fskip:           Skip EOF characterss.
7. ibs:               Input Block Size.
8. obs:              Output Block Size.
9. if:                 Input File.
10. of:                Output File.
11. seek:          Skip to record number specified.
12. skip:           Skip number of input blocks.
13. span:          [yes|no] This option is used if your file will span over multiple devices, if the input file is larger than output devices.

Now, for demo purpose I have created a file named as lower. I have added the text to this file.

How To Translate From Lower Case To Upper Case In A File
The following example will demonstrate how to translate a file from lowercase to uppercase and vice versa.

wiwlabs:$ cat lower
dd example for demonstrating translation.
wiwlabs:$ dd conv=ucase if=lower of=upper
0+1 records in
0+1 records out
wiwlabs:$ cat upper
DD EXAMPLE FOR DEMONSTRATING TRANSLATION.
wiwlabs:$ dd conv=lcase if=upper of=lower_case_file
0+1 records in
0+1 records out
wiwlabs:$ cat lower_case_file
dd example for demonstrating translation.

Another nice example is to use dd with pipe:


wsd007:$ cat lower|dd conv=ucase
DD EXAMPLE FOR DEMONSTRATING CONVERSION.
0+1 records in
0+1 records out
wsd007:$ cat upper|dd conv=lcase
dd example from demonstrating translation.
0+1 records in
0+1 records out


How To Create A Duplicate Copy of Diskette

wiwlabs:$  dd if=/dev/fd0 of=/tmp/fdcopy
2880+0 records in.
2880+0 records out.
wiwlabs:$  dd if=/tmp/fdcopy of=/dev/fd0
2880+0 records in.
2880+0 records out.


How To Convert An ASCII text file to EBCDIC Type And Vice-Versa

wiwlabs:$ cat lower
dd example for demonstrating conversion.
wiwlabs:$ dd conv=ebcdic if=lower of=text.ebcdic
0+1 records in
0+1 records out
wiwlabs:$ cat text.ebcdic
@
§
@@
¢££@¥
wiwlabs:$ dd if=text.ebcdic of=text.ascii conv=ascii
0+1 records in
0+1 records out
wiwlabs:$ cat text.ascii
dd example for demonstrating conversion.


How To Copy Blocks From A Tape With 2KB Blocks To Another With 1KB Blocks

dd if=/dev/rmt0  ibs=2048 obs=1024 of=/dev/rmt2


How To Copy Blocks From An Input File With Block Size 32k To Tape

dd if=some_large_file  bs=32k  of=/dev/rmt0 conv=sync  span=yes

1 thought on “The dd Command FAQs”

  1. Pingback: How To Recover A Superblock | World is Welcome To The World of Unix!!!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Date Command Tutorial(Video)
  • grep Command Tutorial – 1(Video)
  • Introduction To ls Command(Video)
  • Chapter 3
  • Set Position Of Poll Module Into Joomla

Recent Comments

  • Kansas City Trailer Proz on Physical Volume In AIX – A Primer
  • Create volume group in AIX | myunixsheet on How To Create Volume Group
  • Restore of AIX backup on other Unix system - TecHub on What is mksysb And What Are Its Components
  • Firewall Unleashed - InfoSec Institute on Packet Filtering Firewall: An Introduction
  • Manwendra on Proxy Firewall and Gateway Firewall: Introduction

Archives

  • January 2019
  • June 2010
  • May 2010
  • February 2010
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008

Categories

  • 30 Days To Joomla WebSite Setup
  • A Journey To The World of Linux System Administration
  • Aix
  • Backups
  • Books
  • Firewalls
  • Introduction
  • Joomla
  • Joomla Backup
  • Joomla Web Technology
  • Linux
  • LPAR and Virtualization
  • LVM
  • Pluggable Authentication Modules
  • section navigator pro
  • Security
  • Security Knowledge Base
  • Tips and Tricks
  • Uncategorized
  • World is Welcome Products

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
©2023 World is Welcome To The World of Linux | WordPress Theme by SuperbThemes