Print this page
10911 dd: add input flag fullblock

*** 44,708 **** .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved .\" Copyright (c) 2014, Joyent, Inc. All rights Reserved. .\" Copyright (c) 2014 by Delphix. All rights reserved. .\" ! .TH DD 1M "Dec 12, 2014" ! .SH NAME ! dd \- convert and copy a file ! .SH SYNOPSIS ! .LP ! .nf ! \fB/usr/bin/dd\fR [\fIoperand=value\fR]... ! .fi ! ! .SH DESCRIPTION ! .LP ! The \fBdd\fR utility copies the specified input file to the specified output ! with possible conversions. The standard input and output are used by default. The input and output block sizes may be specified to take advantage of raw ! physical I/O. Sizes are specified in bytes; a number may end with \fBk\fR, ! \fBb\fR, or \fBw\fR to specify multiplication by 1024, 512, or 2, respectively. ! Numbers may also be separated by \fBx\fR to indicate multiplication. ! .sp ! .LP ! The \fBdd\fR utility reads the input one block at a time, using the specified ! input block size. \fBdd\fR then processes the block of data actually returned, ! which could be smaller than the requested block size. \fBdd\fR applies any ! conversions that have been specified and writes the resulting data to the ! output in blocks of the specified output block size. ! .sp ! .LP ! \fBcbs\fR is used only if \fBascii\fR, \fBasciib\fR, \fBunblock\fR, ! \fBebcdic\fR, \fBebcdicb\fR, \fBibm\fR, \fBibmb\fR, or \fBblock\fR conversion ! is specified. In the first two cases, \fBcbs\fR characters are copied into the ! conversion buffer, any specified character mapping is done, trailing blanks are ! trimmed, and a \fBNEWLINE\fR is added before sending the line to output. In the ! last three cases, characters up to \fBNEWLINE\fR are read into the conversion ! buffer and blanks are added to make up an output record of size \fBcbs\fR. ! \fBASCII\fR files are presumed to contain \fBNEWLINE\fR characters. If ! \fBcbs\fR is unspecified or \fB0\fR, the \fBascii\fR, \fBasciib\fR, ! \fBebcdic\fR, \fBebcdicb\fR, \fBibm\fR, and \fBibmb\fR options convert the ! character set without changing the input file's block structure. The ! \fBunblock\fR and \fBblock\fR options become a simple file copy. ! .sp ! .LP ! After completion, \fBdd\fR reports the number of whole and partial input and ! output blocks. ! .SH OPERANDS ! .LP The following operands are supported: ! .sp ! .ne 2 ! .na ! \fB\fBif=\fR\fIfile\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Specifies the input path. Standard input is the default. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBof=\fR\fIfile\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Specifies the output path. Standard output is the default. If the ! \fBseek=\fR\fBexpr\fR conversion is not also specified, the output file will be ! truncated before the copy begins, unless \fBconv=notrunc\fR is specified. If ! \fBseek=\fR\fBexpr\fR is specified, but \fBconv=notrunc\fR is not, the effect ! of the copy will be to preserve the blocks in the output file over which ! \fBdd\fR seeks, but no other portion of the output file will be preserved. (If ! the size of the seek plus the size of the input file is less than the previous ! size of the output file, the output file is shortened by the copy.) ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBibs=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Specifies the input block size in \fIn\fR bytes (default is \fB512\fR). ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBobs=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Specifies the output block size in \fIn\fR bytes (default is \fB512\fR). ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBbs=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Sets both input and output block sizes to \fIn\fR bytes, superseding \fBibs=\fR ! and \fBobs=\fR. If no conversion other than \fBsync\fR,\fB noerror\fR, and ! \fBnotrunc\fR is specified, each input block is copied to the output as a single block without aggregating short blocks. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBcbs=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Specifies the conversion block size for \fBblock\fR and \fBunblock\fR in bytes ! by \fIn\fR (default is \fB0\fR). If \fBcbs=\fR is omitted or given a value of ! \fB0\fR, using \fBblock\fR or \fBunblock\fR produces unspecified results. ! .sp ! This option is used only if \fBASCII\fR or \fBEBCDIC\fR conversion is ! specified. For the \fBascii\fR and \fBasciib\fR operands, the input is handled ! as described for the \fBunblock\fR operand except that characters are converted ! to \fBASCII\fR before the trailing \fBSPACE\fR characters are deleted. For the ! \fBebcdic\fR, \fBebcdicb\fR, \fBibm\fR, and \fBibmb\fR operands, the input is ! handled as described for the \fBblock\fR operand except that the characters are ! converted to \fBEBCDIC\fR or IBM \fBEBCDIC\fR after the trailing \fBSPACE\fR characters are added. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBfiles=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Copies and concatenates \fIn\fR input files before terminating (makes sense only where input is a magnetic tape or similar device). ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBskip=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Skips \fIn\fR input blocks (using the specified input block size) before ! starting to copy. On seekable files, the implementation reads the blocks or ! seeks past them. On non-seekable files, the blocks are read and the data is ! discarded. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBiseek=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Seeks \fIn\fR blocks from beginning of input file before copying (appropriate ! for disk files, where \fBskip\fR can be incredibly slow). ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBoseek=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Seeks \fIn\fR blocks from beginning of output file before copying. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBseek=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Skips \fIn\fR blocks (using the specified output block size) from beginning of ! output file before copying. On non-seekable files, existing blocks are read and ! space from the current end-of-file to the specified offset, if any, is filled ! with null bytes. On seekable files, the implementation seeks to the specified offset or reads the blocks as described for non-seekable files. ! .RE ! .sp ! .ne 2 ! .na ! \fB\fBostride=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Writes every \fIn\fRth block (using the specified output block size) when ! writing output. Skips \fIn\fR - 1 blocks after writing each record. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBistride=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Reads every \fIn\fRth block (using the specified input block size) when ! reading input. Skips \fIn\fR - 1 blocks after reading each record. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBstride=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Reads every \fIn\fRth block (using the specified input block size) when ! reading input. Skips \fIn\fR - 1 blocks after reading each record. Also ! writes every \fIn\fRth block (using the specified output block size) when ! writing output. Skips \fIn\fR - 1 blocks after writing each record. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBcount=\fR\fIn\fR\fR ! .ad ! .sp .6 ! .RS 4n ! Copies only \fIn\fR input blocks. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBconv=\fR\fIvalue\fR[\fB,\fR\fIvalue\fR.\|.\|.\|]\fR ! .ad ! .sp .6 ! .RS 4n ! Where \fIvalue\fRs are comma-separated symbols from the following list: ! .sp ! .ne 2 ! .na ! \fB\fBascii\fR\fR ! .ad ! .RS 11n ! Converts \fBEBCDIC\fR to \fBASCII\fR. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBasciib\fR\fR ! .ad ! .RS 11n ! Converts \fBEBCDIC\fR to \fBASCII\fR using \fBBSD\fR-compatible character ! translations. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBebcdic\fR\fR ! .ad ! .RS 11n ! Converts \fBASCII\fR to \fBEBCDIC\fR. If converting fixed-length \fBASCII\fR ! records without NEWLINEs, sets up a pipeline with \fBdd conv=unblock\fR beforehand. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBebcdicb\fR\fR .ad - .RS 11n - Converts \fBASCII\fR to \fBEBCDIC\fR using \fBBSD\fR-compatible character - translations. If converting fixed-length \fBASCII\fR records without - \fBNEWLINE\fRs, sets up a pipeline with \fBdd conv=unblock\fR beforehand. - .RE - - .sp - .ne 2 - .na - \fB\fBibm\fR\fR - .ad - .RS 11n - Slightly different map of \fBASCII\fR to \fBEBCDIC\fR. If converting - fixed-length \fBASCII\fR records without \fBNEWLINE\fRs, sets up a pipeline - with \fBdd conv=unblock\fR beforehand. - .RE - - .sp - .ne 2 - .na - \fB\fBibmb\fR\fR - .ad - .RS 11n - Slightly different map of \fBASCII\fR to \fBEBCDIC\fR using - \fBBSD\fR-compatible character translations. If converting fixed-length - \fBASCII\fR records without \fBNEWLINE\fRs, sets up a pipeline with \fBdd - conv=unblock\fR beforehand. - .RE - - The \fBascii\fR (or \fBasciib\fR), \fBebcdic\fR (or \fBebcdicb\fR), and - \fBibm\fR (or \fBibmb\fR) values are mutually exclusive. - .sp - .ne 2 - .na - \fB\fBblock\fR\fR - .ad - .RS 11n - Treats the input as a sequence of \fBNEWLINE\fR-terminated or - \fBEOF\fR-terminated variable-length records independent of the input block - boundaries. Each record is converted to a record with a fixed length specified - by the conversion block size. Any \fBNEWLINE\fR character is removed from the - input line. \fBSPACE\fR characters are appended to lines that are shorter than - their conversion block size to fill the block. Lines that are longer than the - conversion block size are truncated to the largest number of characters that - will fit into that size. The number of truncated lines is reported. - .RE - - .sp - .ne 2 - .na - \fB\fBunblock\fR\fR - .ad - .RS 11n - Converts fixed-length records to variable length. Reads a number of bytes equal - to the conversion block size (or the number of bytes remaining in the input, if - less than the conversion block size), delete all trailing \fBSPACE\fR - characters, and append a \fBNEWLINE\fR character. - .RE - - The \fBblock\fR and \fBunblock\fR values are mutually exclusive. - .sp - .ne 2 - .na - \fB\fBlcase\fR\fR - .ad - .RS 9n - Maps upper-case characters specified by the \fBLC_CTYPE\fR keyword - \fBtolower\fR to the corresponding lower-case character. Characters for which - no mapping is specified are not modified by this conversion. - .RE - - .sp - .ne 2 - .na - \fB\fBucase\fR\fR - .ad - .RS 9n - Maps lower-case characters specified by the \fBLC_CTYPE\fR keyword - \fBtoupper\fR to the corresponding upper-case character. Characters for which - no mapping is specified are not modified by this conversion. - .RE - - The \fBlcase\fR and \fBucase\fR symbols are mutually exclusive. - .sp - .ne 2 - .na - \fB\fBswab\fR\fR - .ad - .RS 11n - Swaps every pair of input bytes. If the current input record is an odd number - of bytes, the last byte in the input record is ignored. - .RE - - .sp - .ne 2 - .na - \fB\fBnoerror\fR\fR - .ad - .RS 11n - Does not stop processing on an input error. When an input error occurs, a - diagnostic message is written on standard error, followed by the current input - and output block counts in the same format as used at completion. If the - \fBsync\fR conversion is specified, the missing input is replaced with null - bytes and processed normally. Otherwise, the input block will be omitted from - the output. - .RE - - .sp - .ne 2 - .na - \fB\fBnotrunc\fR\fR - .ad - .RS 11n - Does not truncate the output file. Preserves blocks in the output file not - explicitly written by this invocation of \fBdd\fR. (See also the preceding - \fBof=\fR\fIfile\fR operand.) - .RE - - .sp - .ne 2 - .na - \fB\fBsync\fR\fR - .ad - .RS 11n - Pads every input block to the size of the \fBibs=\fR buffer, appending null - bytes. (If either \fBblock\fR or \fBunblock\fR is also specified, appends - \fBSPACE\fR characters, rather than null bytes.) - .RE - - .RE - - .sp - .ne 2 - .na - \fB\fBoflag=\fR\fIvalue\fR[\fB,\fR\fIvalue\fR.\|.\|.\|]\fR - .ad .sp .6 ! Where \fIvalue\fRs are comma-separated symbols from the following list which affect the behavior of writing the output file: ! .sp ! .ne 2 ! .na ! \fB\fBdsync\fR\fR ! .ad ! .RS 11n ! The output file is opened with the \fBO_DSYNC\fR flag set. All data writes will ! be synchronous. For more information on \fBO_DSYNC\fR see \fBfcntl.h\fR(3HEAD). ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fBsync\fR\fR ! .ad ! .RS 11n ! The output file is opened with the \fBO_SYNC\fR flag set. All data and metadata ! writes will be synchronous. For more information on \fBO_SYNC\fR see ! \fBfcntl.h\fR(3HEAD). ! .RE ! ! .sp ! .LP ! If operands other than \fBconv=\fR and \fBoflag=\fR are specified more than once, ! the last specified \fBoperand=\fR\fIvalue\fR is used. ! .sp ! .LP ! For the \fBbs=\fR, \fBcbs=\fR, \fBibs=\fR, and \fBobs=\fR operands, the ! application must supply an expression specifying a size in bytes. The ! expression, \fBexpr\fR, can be: ! .RS +4 ! .TP ! 1. a positive decimal number ! .RE ! .RS +4 ! .TP ! 2. ! a positive decimal number followed by \fBk\fR, specifying multiplication by ! 1024 ! .RE ! .RS +4 ! .TP ! 3. ! a positive decimal number followed by \fBM\fR, specifying multiplication by ! 1024*1024 ! .RE ! .RS +4 ! .TP ! 4. ! a positive decimal number followed by \fBG\fR, specifying multiplication by ! 1024*1024*1024 ! .RE ! .RS +4 ! .TP ! 5. ! a positive decimal number followed by \fBT\fR, specifying multiplication by ! 1024*1024*1024*1024 ! .RE ! .RS +4 ! .TP ! 6. ! a positive decimal number followed by \fBP\fR, specifying multiplication by ! 1024*1024*1024*1024*1024 ! .RE ! .RS +4 ! .TP ! 7. ! a positive decimal number followed by \fBE\fR, specifying multiplication by ! 1024*1024*1024*1024*1024*1024 ! .RE ! .RS +4 ! .TP ! 8. ! a positive decimal number followed by \fBZ\fR, specifying multiplication by ! 1024*1024*1024*1024*1024*1024*1024 ! .RE ! .RS +4 ! .TP ! 9. ! a positive decimal number followed by \fBb\fR, specifying multiplication by ! 512 ! .RE ! .RS +4 ! .TP ! 10. ! two or more positive decimal numbers (with or without \fBk\fR or \fBb\fR) ! separated by \fBx\fR, specifying the product of the indicated values. ! .RE ! .sp ! .LP All of the operands will be processed before any input is read. ! .SH SIGNALS ! .LP ! When \fBdd\fR receives either SIGINFO or SIGUSR1, \fBdd\fR will emit the current ! input and output block counts, total bytes written, total time elapsed, and the ! number of bytes per second to standard error. This is the same information ! format that \fBdd\fR emits when it successfully completes. Users may send ! SIGINFO via their terminal. The default character is ^T, see \fBstty\fR(1) for ! more information. ! .sp ! .LP ! For \fBSIGINT\fR, \fBdd\fR writes status information to standard error before ! exiting. \fBdd\fR takes the standard action for all other signals. ! ! .SH USAGE ! .LP ! See \fBlargefile\fR(5) for the description of the behavior of \fBdd\fR when ! encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). ! .SH EXAMPLES ! .LP ! \fBExample 1 \fRCopying from one tape drive to another ! .sp ! .LP ! The following example copies from tape drive \fB0\fR to tape drive \fB1\fR, ! using a common historical device naming convention. ! ! .sp ! .in +2 ! .nf ! example% \fBdd if=/dev/rmt/0h of=/dev/rmt/1h\fR ! .fi ! .in -2 ! .sp ! ! .LP ! \fBExample 2 \fRStripping the first 10 bytes from standard input ! .sp ! .LP ! The following example strips the first 10 bytes from standard input: ! ! .sp ! .in +2 ! .nf ! example% \fBdd ibs=10 skip=1\fR ! .fi ! .in -2 ! .sp ! ! .LP ! \fBExample 3 \fRReading a tape into an ASCII file ! .sp ! .LP ! This example reads an \fBEBCDIC\fR tape blocked ten 80-byte \fBEBCDIC\fR card ! images per block into the \fBASCII\fR file \fBx\fR: ! ! .sp ! .in +2 ! .nf ! example% \fBdd if=/dev/tape of=x ibs=800 cbs=80 conv=ascii,lcase\fR ! .fi ! .in -2 ! .sp ! ! .LP ! \fBExample 4 \fRUsing conv=sync to write to tape ! .sp ! .LP ! The following example uses \fBconv=sync\fR when writing to a tape: ! ! .sp ! .in +2 ! .nf ! example% \fBtar cvf - . | compress | dd obs=1024k of=/dev/rmt/0 conv=sync\fR ! .fi ! .in -2 ! .sp ! ! .SH ENVIRONMENT VARIABLES ! .LP ! See \fBenviron\fR(5) for descriptions of the following environment variables ! that affect the execution of \fBdd\fR: \fBLANG\fR, \fBLC_ALL\fR, ! \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. ! .SH EXIT STATUS ! .LP The following exit values are returned: ! .sp ! .ne 2 ! .na ! \fB\fB0\fR\fR ! .ad ! .RS 6n The input file was copied successfully. ! .RE ! ! .sp ! .ne 2 ! .na ! \fB\fB>0\fR\fR ! .ad ! .RS 6n An error occurred. ! .RE ! ! .sp ! .LP ! If an input error is detected and the \fBnoerror\fR conversion has not been ! specified, any partial output block will be written to the output file, a ! diagnostic message will be written, and the copy operation will be ! discontinued. If some other error is detected, a diagnostic message will be written and the copy operation will be discontinued. ! .SH ATTRIBUTES ! .LP ! See \fBattributes\fR(5) for descriptions of the following attributes: ! .sp ! ! .sp ! .TS ! box; ! c | c ! l | l . ! ATTRIBUTE TYPE ATTRIBUTE VALUE ! _ ! Interface Stability Standard ! .TE ! ! .SH SEE ALSO ! .LP ! \fBcp\fR(1), \fBsed\fR(1), \fBtr\fR(1), \fBfcntl.h\fR(3HEAD), ! \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5) ! .SH DIAGNOSTICS ! .ne 2 ! .na ! \fB\fBf+p records in(out)\fR\fR ! .ad ! .RS 23n numbers of full and partial blocks read(written) ! .RE ! ! .SH NOTES ! .LP ! Do not use \fBdd\fR to copy files between file systems having different block ! sizes. ! .sp ! .LP Using a blocked device to copy a file will result in extra nulls being added to the file to pad the final block to the block boundary. ! .sp ! .LP ! When \fBdd\fR reads from a pipe, using the \fBibs=X\fR and \fBobs=Y\fR ! operands, the output will always be blocked in chunks of size Y. When ! \fBbs=Z\fR is used, the output blocks will be whatever was available to be read from the pipe at the time. ! .sp ! .LP ! When using \fBdd\fR to copy files to a tape device, the file size must be a ! multiple of the device sector size (for example, 512 Kbyte). To copy files of ! arbitrary size to a tape device, use \fBtar\fR(1) or \fBcpio\fR(1). --- 44,748 ---- .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved .\" Copyright (c) 2014, Joyent, Inc. All rights Reserved. .\" Copyright (c) 2014 by Delphix. All rights reserved. .\" ! .Dd May 4, 2019 ! .Dt DD 1M ! .Os ! .Sh NAME ! .Nm dd ! .Nd convert and copy a file ! .Sh SYNOPSIS ! .Nm /usr/bin/dd ! .Op Ar operand=value ! .Ar ... ! .Sh DESCRIPTION ! The ! .Nm dd ! utility copies the specified input file to the specified output ! with possible conversions. ! The standard input and output are used by default. The input and output block sizes may be specified to take advantage of raw ! physical I/O. ! Sizes are specified in bytes; a number may end with ! .Sy k , ! .Sy b , ! or ! .Sy w ! to specify multiplication by 1024, 512, or 2, respectively. ! Numbers may also be separated by ! .Sy x ! to indicate multiplication. ! .Pp ! The ! .Nm ! utility reads the input one block at a time, using the specified ! input block size. ! .Nm ! then processes the block of data actually returned, ! which could be smaller than the requested block size unless the input flag ! .Ar fullblock ! is used. ! .Nm ! applies any conversions that have been specified and writes the resulting data ! to the output in blocks of the specified output block size. ! .Pp ! .Sy cbs ! is used only if ! .Sy ascii , ! .Sy asciib , ! .Sy unblock , ! .Sy ebcdic , ! .Sy ebcdicb , ! .Sy ibm , ! .Sy ibmb , ! or ! .Sy block ! conversion is specified. ! In the first two cases, ! .Sy cbs ! characters are copied into the conversion buffer, any specified character ! mapping is done, trailing blanks are trimmed, and a ! .Sy NEWLINE ! is added before sending the line to output. ! In the last three cases, characters up to ! .Sy NEWLINE ! are read into the conversion buffer and blanks are added to make up an output ! record of size ! .Sy cbs . ! .Sy ASCII ! files are presumed to contain ! .Sy NEWLINE ! characters. ! If ! .Sy cbs ! is unspecified or ! .Sy 0 , ! the ! .Sy ascii , ! .Sy asciib , ! .Sy ebcdic , ! .Sy ebcdicb , ! .Sy ibm , ! and ! .Sy ibmb ! options convert the character set without changing the input file's block ! structure. ! The ! .Sy unblock ! and ! .Sy block ! options become a simple file copy. ! .Pp ! After completion, ! .Nm ! reports the number of whole and partial input and output blocks. ! .Sh OPERANDS The following operands are supported: ! .Bl -hang ! .It Sy if= Ns Ar file ! .Pp ! Specifies the input path. ! Standard input is the default. ! .It Sy of= Ns Ar file ! .Pp ! Specifies the output path. ! Standard output is the default. ! If the ! .Sy seek=expr ! conversion is not also specified, the output file will be truncated before ! the copy begins, unless ! .Sy conv=notrunc ! is specified. ! If ! .Sy seek=expr ! is specified, but ! .Sy conv=notrunc ! is not, the effect of the copy will be to preserve the blocks in the output ! file over which ! .Nm ! seeks, but no other portion of the output file will be preserved. ! (If the size of the seek plus the size of the input file is less than the ! previous size of the output file, the output file is shortened by the copy.) ! .It Sy ibs= Ns Ar n ! .Pp ! Specifies the input block size in ! .Ar n ! bytes (default is ! .Sy 512 Ns ! ). ! .It Sy obs= Ns Ar n ! .Pp ! Specifies the output block size in ! .Ar n ! bytes (default is ! .Sy 512 Ns ! ). ! .It Sy bs= Ns Ar n ! .Pp ! Sets both input and output block sizes to ! .Ar n ! bytes, superseding ! .Sy ibs= ! and ! .Sy obs= . ! If no conversion other than ! .Sy sync , ! .Sy noerror , ! and ! .Sy notrunc ! is specified, each input block is copied to the output as a single block without aggregating short blocks. ! .It Sy cbs= Ns Ar n ! .Pp ! Specifies the conversion block size for ! .Sy block ! and ! .Sy unblock ! in bytes by ! .Ar n ! (default is ! .Sy 0 Ns ). ! If ! .Sy cbs= ! is omitted or given a value of ! .Sy 0 , ! using ! .Sy block ! or ! .Sy unblock ! produces unspecified results. ! .Pp ! This option is used only if ! .Sy ASCII ! or ! .Sy EBCDIC ! conversion is specified. ! For the ! .Sy ascii ! and ! .Sy asciib ! operands, the input is handled as described for the ! .Sy unblock ! operand except that characters are converted to ! .Sy ASCII ! before the trailing ! .Sy SPACE ! characters are deleted. ! For the ! .Sy ebcdic , ! .Sy ebcdicb , ! .Sy ibm , ! and ! .Sy ibmb ! operands, the input is handled as described for the ! .Sy block ! operand except that the characters are converted to ! .Sy EBCDIC ! or IBM ! .Sy EBCDIC ! after the trailing ! .Sy SPACE characters are added. ! .It Sy files= Ns Ar n ! .Pp ! Copies and concatenates ! .Ar n ! input files before terminating (makes sense only where input is a magnetic tape or similar device). ! .It Sy skip= Ns Ar n ! .Pp ! Skips ! .Ar n ! input blocks (using the specified input block size) before starting to copy. ! On seekable files, the implementation reads the blocks or seeks past them. ! On non-seekable files, the blocks are read and the data is discarded. ! .It Sy iseek= Ns Ar n ! .Pp ! Seeks ! .Ar n ! blocks from beginning of input file before copying (appropriate ! for disk files, where ! .Sy skip ! can be incredibly slow). ! .It Sy oseek= Ns Ar n ! .Pp ! Seeks ! .Ar n ! blocks from beginning of output file before copying. ! .It Sy seek= Ns Ar n ! .Pp ! Skips ! .Ar n ! blocks (using the specified output block size) from beginning of ! output file before copying. ! On non-seekable files, existing blocks are read and space from the current ! end-of-file to the specified offset, if any, is filled with null bytes. ! On seekable files, the implementation seeks to the specified offset or reads the blocks as described for non-seekable files. ! .It Sy ostride= Ns Ar n ! .Pp ! Writes every ! .Ar n Ns ! th block (using the specified output block size) when writing output. ! Skips ! .Ar n ! - 1 blocks after writing each record. ! .It Sy istride= Ns Ar n ! .Pp ! Reads every ! .Ar n Ns ! th block (using the specified input block size) when reading input. ! Skips ! .Ar n ! - 1 blocks after reading each record. ! .It Sy stride= Ns Ar n ! .Pp ! Reads every ! .Ar n Ns ! th block (using the specified input block size) when reading input. ! Skips ! .Ar n ! - 1 blocks after reading each record. ! Also writes every ! .Ar n Ns ! th block (using the specified output block size) when writing output. ! Skips ! .Ar n ! - 1 blocks after writing each record. ! .It Sy count= Ns Ar n ! .Pp ! Copies only ! .Ar n ! input blocks. ! .It Sy conv= Ns Ar value Ns Op , Ns Ar value Ns ... ! .Pp ! Where ! .Ar value Ns ! s are comma-separated symbols from the following list: ! .Bl -hang ! .It Sy ascii ! Converts ! .Sy EBCDIC ! to ! .Sy ASCII . .sp ! .It Sy asciib ! Converts ! .Sy EBCDIC ! to ! .Sy ASCII ! using ! .Sy BSD Ns ! -compatible character translations. ! .It Sy ebcdic ! Converts ! .Sy ASCII ! to ! .Sy EBCDIC . ! If converting fixed-length ! .Sy ASCII ! records without ! .Sy NEWLINE Ns ! s, sets up a pipeline with ! .Nm ! .Sy conv=unblock beforehand. ! .It Sy ebcdicb ! Converts ! .Sy ASCII ! to ! .Sy EBCDIC ! using ! .Sy BSD Ns ! -compatible character translations. ! If converting fixed-length ! .Sy ASCII ! records without ! .Sy NEWLINE Ns ! s, sets up a pipeline with ! .Nm ! .Sy conv=unblock ! beforehand. ! .It Sy ibm ! Slightly different map of ! .Sy ASCII ! to ! .Sy EBCDIC . ! If converting fixed-length ! .Sy ASCII ! records without ! .Sy NEWLINE Ns ! s, sets up a pipeline with ! .Nm ! .Sy conv=unblock ! beforehand. ! .It Sy ibmb ! Slightly different map of ! .Sy ASCII ! to ! .Sy EBCDIC ! using ! .Sy BSD Ns ! -compatible character translations. ! If converting fixed-length ! .Sy ASCII ! records without ! .Sy NEWLINE Ns ! s, sets up a pipeline with ! .Nm ! .Sy conv=unblock ! beforehand. ! .El ! .Pp ! The ! .Sy ascii ! (or ! .Sy asciib ), ! .Sy ebcdic ! (or ! .Sy ebcdicb ), ! and ! .Sy ibm ! (or ! .Sy ibmb ) ! values are mutually exclusive. ! .Bl -hang ! .It Sy block ! Treats the input as a sequence of ! .Sy NEWLINE Ns ! -terminated or ! .Sy EOF Ns ! -terminated variable-length records independent of the input block boundaries. ! Each record is converted to a record with a fixed length specified ! by the conversion block size. ! Any ! .Sy NEWLINE ! character is removed from the input line. ! .Sy SPACE ! characters are appended to lines that are shorter than their conversion block ! size to fill the block. ! Lines that are longer than the conversion block size are truncated to the ! largest number of characters that will fit into that size. ! The number of truncated lines is reported. ! .It Sy unblock ! Converts fixed-length records to variable length. ! Reads a number of bytes equal to the conversion block size (or the number of ! bytes remaining in the input, if less than the conversion block size), ! delete all trailing ! .Sy SPACE ! characters, and append a ! .Sy NEWLINE ! character. ! .El ! .Pp ! The ! .Sy block ! and ! .Sy unblock ! values are mutually exclusive. ! .Bl -hang ! .It Sy lcase ! Maps upper-case characters specified by the ! .Sy LC_CTYPE ! keyword ! .Sy tolower ! to the corresponding lower-case character. ! Characters for which no mapping is specified are not modified by this ! conversion. ! .It Sy ucase ! Maps lower-case characters specified by the ! .Sy LC_CTYPE ! keyword ! .Sy toupper ! to the corresponding upper-case character. ! Characters for which no mapping is specified are not modified by this ! conversion. ! .El ! .Pp ! The ! .Sy lcase ! and ! .Sy ucase ! symbols are mutually exclusive. ! .Bl -hang ! .It Sy swab ! Swaps every pair of input bytes. ! If the current input record is an odd number of bytes, the last byte in the ! input record is ignored. ! .It Sy noerror ! Does not stop processing on an input error. ! When an input error occurs, a diagnostic message is written on standard error, ! followed by the current input and output block counts in the same format as ! used at completion. ! If the ! .Sy sync ! conversion is specified, the missing input is replaced with null ! bytes and processed normally. ! Otherwise, the input block will be omitted from the output. ! .It Sy notrunc ! Does not truncate the output file. ! Preserves blocks in the output file not explicitly written by this invocation ! of ! .Nm . ! (See also the preceding ! .Sy of= Ns Ar file ! operand.) ! .It Sy sync ! Pads every input block to the size of the ! .Sy ibs= ! buffer, appending null bytes. ! (If either ! .Sy block ! or ! .Sy unblock ! is also specified, appends ! .Sy SPACE ! characters, rather than null bytes.) ! .El ! .It Sy iflag= Ns Ar value Ns Op , Ns Ar value ... ! .Pp ! Where ! .Ar value Ns ! s are comma-separated symbols from the following list which ! affect the behavior of reading from the input file: ! .Bl -hang ! .It Sy fullblock ! Accumulate full blocks of input. ! .El ! .It Sy oflag= Ns Ar value Ns Op , Ns Ar value ... .ad .sp .6 ! Where ! .Ar value Ns ! s are comma-separated symbols from the following list which affect the behavior of writing the output file: ! .Bl -hang ! .It Sy dsync ! The output file is opened with the ! .Sy O_DSYNC ! flag set. ! All data writes will be synchronous. ! For more information on ! .Sy O_DSYNC ! see ! .Xr fcntl.h 3HEAD . ! .It Sy sync ! The output file is opened with the ! .Sy O_SYNC . ! All data and metadata writes will be synchronous. ! For more information on ! .Sy O_SYNC ! see ! .Xr fcntl.h 3HEAD . ! .El ! .El ! .Pp ! If operands other than ! .Sy conv= ! and ! .Sy oflag= ! are specified more than once, the last specified ! .Sy operand= Ns Ar value ! is used. ! .Pp ! For the ! .Sy bs= , ! .Sy cbs= , ! .Sy ibs= , ! and ! .Sy obs= ! operands, the application must supply an expression specifying a size in bytes. ! The expression, ! .Sy expr , ! can be: ! .Bl -enum -offset indent -compact ! .It a positive decimal number ! .Pp ! .It ! a positive decimal number followed by ! .Sy k , ! specifying multiplication by 1024 ! .Pp ! .It ! a positive decimal number followed by ! .Sy M , ! specifying multiplication by 1024*1024 ! .Pp ! .It ! a positive decimal number followed by ! .Sy G , ! specifying multiplication by 1024*1024*1024 ! .Pp ! .It ! a positive decimal number followed by ! .Sy T , ! specifying multiplication by 1024*1024*1024*1024 ! .Pp ! .It ! a positive decimal number followed by ! .Sy P , ! specifying multiplication by 1024*1024*1024*1024*1024 ! .Pp ! .It ! a positive decimal number followed by ! .Sy E , ! specifying multiplication by 1024*1024*1024*1024*1024*1024 ! .Pp ! .It ! a positive decimal number followed by ! .Sy Z , ! specifying multiplication by 1024*1024*1024*1024*1024*1024*1024 ! .Pp ! .It ! a positive decimal number followed by ! .Sy b , ! specifying multiplication by 512 ! .Pp ! .It ! two or more positive decimal numbers (with or without ! .Sy k ! or ! .Sy b ) ! separated by ! .Sy x , ! specifying the product of the indicated values. ! .El ! .Pp All of the operands will be processed before any input is read. ! .Sh SIGNALS ! When ! .Nm ! receives either SIGINFO or SIGUSR1, ! .Nm ! will emit the current input and output block counts, total bytes written, ! total time elapsed, and the number of bytes per second to standard error. ! This is the same information format that ! .Nm ! emits when it successfully completes. ! Users may send SIGINFO via their terminal. ! The default character is ^T, see ! .Xr stty 1 ! for more information. ! .Pp ! For ! .Sy SIGINT , ! .Nm ! writes status information to standard error before exiting. ! .Nm ! takes the standard action for all other signals. ! .Sh USAGE ! See ! .Xr largefile 5 ! for the description of the behavior of ! .Nm ! when encountering files greater than or equal to 2 Gbyte (2^31 bytes). ! .Sh EXIT STATUS The following exit values are returned: ! .Bl -hang ! .It Sy 0 The input file was copied successfully. ! .It Sy >0 An error occurred. ! .El ! .Pp ! If an input error is detected and the ! .Sy noerror ! conversion has not been specified, any partial output block will be written ! to the output file, a diagnostic message will be written, and the copy ! operation will be discontinued. ! If some other error is detected, a diagnostic message will be written and the copy operation will be discontinued. ! .Sh EXAMPLES ! .Bl -ohang ! .It Sy Example 1 No Copying from one tape drive to another ! .Pp ! The following example copies from tape drive ! .Sy 0 ! to tape drive ! .Sy 1 , ! using a common historical device naming convention. ! .Pp ! .Dl % dd if=/dev/rmt/0h of=/dev/rmt/1h ! .It Sy Example 2 No Stripping the first 10 bytes from standard input ! .Pp ! The following example strips the first 10 bytes from standard input: ! .Pp ! .Dl % dd ibs=10 skip=1 ! .It Sy Example 3 No Reading a tape into an ASCII file ! .Pp ! This example reads an ! .Sy EBCDIC ! tape blocked ten 80-byte ! .Sy EBCDIC ! card images per block into the ! .Sy ASCII ! file ! .Sy x : ! .Pp ! .Dl % dd if=/dev/tape of=x ibs=800 cbs=80 conv=ascii,lcase ! .It Sy Example 4 No Using conv=sync to write to tape ! .Pp ! The following example uses ! .Sy conv=sync ! when writing to a tape: ! .Pp ! .Dl % tar cvf - . | compress | dd obs=1024k of=/dev/rmt/0 conv=sync ! .El ! .Sh DIAGNOSTICS ! .Bl -hang ! .It Sy f+p records in(out) numbers of full and partial blocks read(written) ! .El ! .Sh ENVIRONMENT VARIABLES ! See ! .Xr environ 5 ! for descriptions of the following environment variables ! that affect the execution of ! .Nm : ! .Sy LANG , ! .Sy LC_ALL , ! .Sy LC_CTYPE , ! .Sy LC_MESSAGES , ! and ! .Sy NLSPATH . ! .Sh INTERFACE STABILITY ! Standard ! .Sh SEE ALSO ! .Xr cp 1 , ! .Xr sed 1 , ! .Xr tr 1 , ! .Xr fcntl.h 3HEAD , ! .Xr attributes 5 , ! .Xr environ 5 , ! .Xr largefile 5 , ! .Xr standards 5 ! .Sh NOTES ! Do not use ! .Nm ! to copy files between file systems having different block sizes. ! .Pp Using a blocked device to copy a file will result in extra nulls being added to the file to pad the final block to the block boundary. ! .Pp ! When ! .Nm ! reads from a pipe, using the ! .Sy ibs=X ! and ! .Sy obs=Y ! operands, the output will always be blocked in chunks of size Y. ! When ! .Sy bs=Z ! is used, the output blocks will be whatever was available to be read from the pipe at the time. ! .Pp ! When using ! .Nm ! to copy files to a tape device, the file size must be a multiple of the ! device sector size (for example, 512 Kbyte). ! To copy files of arbitrary size to a tape device, use ! .Xr tar 1 ! or ! .Xr cpio 1 .