19ddb49cbSWarner Losh.\"- 24b88c807SRodney W. Grimes.\" Copyright (c) 1990, 1993 34b88c807SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 44b88c807SRodney W. Grimes.\" 54b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 64b88c807SRodney W. Grimes.\" Keith Muller of the University of California, San Diego. 74b88c807SRodney W. Grimes.\" 84b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 94b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions 104b88c807SRodney W. Grimes.\" are met: 114b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 124b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 134b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 144b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 154b88c807SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 16fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 174b88c807SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 184b88c807SRodney W. Grimes.\" without specific prior written permission. 194b88c807SRodney W. Grimes.\" 204b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 214b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 224b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 234b88c807SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 244b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 254b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 264b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 274b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 284b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 294b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304b88c807SRodney W. Grimes.\" SUCH DAMAGE. 314b88c807SRodney W. Grimes.\" 32*f4b4526fSRichard Scheffenegger.Dd June 4, 2020 334b88c807SRodney W. Grimes.Dt DD 1 344b88c807SRodney W. Grimes.Os 354b88c807SRodney W. Grimes.Sh NAME 364b88c807SRodney W. Grimes.Nm dd 374b88c807SRodney W. Grimes.Nd convert and copy a file 384b88c807SRodney W. Grimes.Sh SYNOPSIS 39be8b1497SRuslan Ermilov.Nm 4080c7362cSGiorgos Keramidas.Op Ar operands ... 414b88c807SRodney W. Grimes.Sh DESCRIPTION 424b88c807SRodney W. GrimesThe 434b88c807SRodney W. Grimes.Nm 444b88c807SRodney W. Grimesutility copies the standard input to the standard output. 454b88c807SRodney W. GrimesInput data is read and written in 512-byte blocks. 464b88c807SRodney W. GrimesIf input reads are short, input from multiple reads are aggregated 474b88c807SRodney W. Grimesto form the output block. 484b88c807SRodney W. GrimesWhen finished, 49cbf6f7d3SPhilippe Charnier.Nm 504b88c807SRodney W. Grimesdisplays the number of complete and partial input and output blocks 514b88c807SRodney W. Grimesand truncated input records to the standard error output. 524b88c807SRodney W. Grimes.Pp 534b88c807SRodney W. GrimesThe following operands are available: 54aeaef479SEric van Gyzen.Bl -tag -width "of=file" 5580c7362cSGiorgos Keramidas.It Cm bs Ns = Ns Ar n 567d159f88SBruce EvansSet both input and output block size to 5780c7362cSGiorgos Keramidas.Ar n 587d159f88SBruce Evansbytes, superseding the 594b88c807SRodney W. Grimes.Cm ibs 604b88c807SRodney W. Grimesand 614b88c807SRodney W. Grimes.Cm obs 624b88c807SRodney W. Grimesoperands. 634b88c807SRodney W. GrimesIf no conversion values other than 644b88c807SRodney W. Grimes.Cm noerror , 654b88c807SRodney W. Grimes.Cm notrunc 664b88c807SRodney W. Grimesor 674b88c807SRodney W. Grimes.Cm sync 684b88c807SRodney W. Grimesare specified, then each input block is copied to the output as a 694b88c807SRodney W. Grimessingle block without any aggregation of short blocks. 7080c7362cSGiorgos Keramidas.It Cm cbs Ns = Ns Ar n 714b88c807SRodney W. GrimesSet the conversion record size to 7280c7362cSGiorgos Keramidas.Ar n 734b88c807SRodney W. Grimesbytes. 744b88c807SRodney W. GrimesThe conversion record size is required by the record oriented conversion 754b88c807SRodney W. Grimesvalues. 7680c7362cSGiorgos Keramidas.It Cm count Ns = Ns Ar n 774b88c807SRodney W. GrimesCopy only 7880c7362cSGiorgos Keramidas.Ar n 794b88c807SRodney W. Grimesinput blocks. 8080c7362cSGiorgos Keramidas.It Cm files Ns = Ns Ar n 814b88c807SRodney W. GrimesCopy 8280c7362cSGiorgos Keramidas.Ar n 834b88c807SRodney W. Grimesinput files before terminating. 844b88c807SRodney W. GrimesThis operand is only applicable when the input device is a tape. 85e3edab4aSRobert Watson.It Cm fillchar Ns = Ns Ar c 86e3edab4aSRobert WatsonWhen padding a block in conversion mode or due to use of 87e3edab4aSRobert Watson.Cm noerror 88e3edab4aSRobert Watsonand 89e3edab4aSRobert Watson.Cm sync 906fa13ec0SRuslan Ermilovmodes, fill with the specified 916fa13ec0SRuslan Ermilov.Tn ASCII 926fa13ec0SRuslan Ermilovcharacter, rather than using a space or 936fa13ec0SRuslan Ermilov.Dv NUL . 9480c7362cSGiorgos Keramidas.It Cm ibs Ns = Ns Ar n 954b88c807SRodney W. GrimesSet the input block size to 9680c7362cSGiorgos Keramidas.Ar n 974b88c807SRodney W. Grimesbytes instead of the default 512. 9880c7362cSGiorgos Keramidas.It Cm if Ns = Ns Ar file 994b88c807SRodney W. GrimesRead input from 1004b88c807SRodney W. Grimes.Ar file 1014b88c807SRodney W. Grimesinstead of the standard input. 102b52c534bSMatt Macy.It Cm iflag Ns = Ns Ar value Ns Op , Ns Ar value ... 103b52c534bSMatt MacyWhere 104b52c534bSMatt Macy.Cm value 105b52c534bSMatt Macyis one of the symbols from the following list. 106b52c534bSMatt Macy.Bl -tag -width "fullblock" 107b52c534bSMatt Macy.It Cm fullblock 108b52c534bSMatt MacyReading from the input file may not obtain a full block. 109b52c534bSMatt MacyWhen a read returns short, continue reading to fill the block. 110b52c534bSMatt MacyWithout this flag, 111b52c534bSMatt Macy.Cm count 112b52c534bSMatt Macylimits the number of times 113b52c534bSMatt Macy.Xr read 2 114b52c534bSMatt Macyis called on the input rather than the number of blocks copied in full. 115b52c534bSMatt MacyMay not be combined with 116b52c534bSMatt Macy.Cm conv=sync . 117*f4b4526fSRichard Scheffenegger.It Cm direct 118*f4b4526fSRichard ScheffeneggerSet the O_DIRECT flag on the input file to make reads bypass any local caching. 119b52c534bSMatt Macy.El 12080c7362cSGiorgos Keramidas.It Cm iseek Ns = Ns Ar n 121a6d413e7SBrian FeldmanSeek on the input file 12280c7362cSGiorgos Keramidas.Ar n 1236be607d0SBrian Feldmanblocks. 1246be607d0SBrian FeldmanThis is synonymous with 12580c7362cSGiorgos Keramidas.Cm skip Ns = Ns Ar n . 12680c7362cSGiorgos Keramidas.It Cm obs Ns = Ns Ar n 1274b88c807SRodney W. GrimesSet the output block size to 12880c7362cSGiorgos Keramidas.Ar n 1294b88c807SRodney W. Grimesbytes instead of the default 512. 13080c7362cSGiorgos Keramidas.It Cm of Ns = Ns Ar file 1314b88c807SRodney W. GrimesWrite output to 1324b88c807SRodney W. Grimes.Ar file 1334b88c807SRodney W. Grimesinstead of the standard output. 1344b88c807SRodney W. GrimesAny regular output file is truncated unless the 1354b88c807SRodney W. Grimes.Cm notrunc 1364b88c807SRodney W. Grimesconversion value is specified. 137a6d413e7SBrian FeldmanIf an initial portion of the output file is seeked past (see the 138c107f9e0SBrian Feldman.Cm oseek 1397d159f88SBruce Evansoperand), 1404b88c807SRodney W. Grimesthe output file is truncated at that point. 141919156e3SMatt Macy.It Cm oflag Ns = Ns Ar value Ns Op , Ns Ar value ... 142919156e3SMatt MacyWhere 143919156e3SMatt Macy.Cm value 144919156e3SMatt Macyis one of the symbols from the following list. 145*f4b4526fSRichard Scheffenegger.Bl -tag -width "direct" 146919156e3SMatt Macy.It Cm fsync 147919156e3SMatt MacySet the O_FSYNC flag on the output file to make writes synchronous. 148919156e3SMatt Macy.It Cm sync 149919156e3SMatt MacySet the O_SYNC flag on the output file to make writes synchronous. 150919156e3SMatt MacyThis is synonymous with the 151919156e3SMatt Macy.Cm fsync 152919156e3SMatt Macyvalue. 153*f4b4526fSRichard Scheffenegger.It Cm direct 154*f4b4526fSRichard ScheffeneggerSet the O_DIRECT flag on the output file to make writes bypass any local caching. 155919156e3SMatt Macy.El 15680c7362cSGiorgos Keramidas.It Cm oseek Ns = Ns Ar n 157c107f9e0SBrian FeldmanSeek on the output file 15880c7362cSGiorgos Keramidas.Ar n 1596be607d0SBrian Feldmanblocks. 1606be607d0SBrian FeldmanThis is synonymous with 16180c7362cSGiorgos Keramidas.Cm seek Ns = Ns Ar n . 16280c7362cSGiorgos Keramidas.It Cm seek Ns = Ns Ar n 1634b88c807SRodney W. GrimesSeek 16480c7362cSGiorgos Keramidas.Ar n 1654b88c807SRodney W. Grimesblocks from the beginning of the output before copying. 1667d159f88SBruce EvansOn non-tape devices, an 1674b88c807SRodney W. Grimes.Xr lseek 2 1684b88c807SRodney W. Grimesoperation is used. 1694b88c807SRodney W. GrimesOtherwise, existing blocks are read and the data discarded. 1704b88c807SRodney W. GrimesIf the user does not have read permission for the tape, it is positioned 1714b88c807SRodney W. Grimesusing the tape 1724b88c807SRodney W. Grimes.Xr ioctl 2 1734b88c807SRodney W. Grimesfunction calls. 1744b88c807SRodney W. GrimesIf the seek operation is past the end of file, space from the current 1754b88c807SRodney W. Grimesend of file to the specified offset is filled with blocks of 17680c7362cSGiorgos Keramidas.Dv NUL 1774b88c807SRodney W. Grimesbytes. 17880c7362cSGiorgos Keramidas.It Cm skip Ns = Ns Ar n 1794b88c807SRodney W. GrimesSkip 18080c7362cSGiorgos Keramidas.Ar n 1814b88c807SRodney W. Grimesblocks from the beginning of the input before copying. 1827d159f88SBruce EvansOn input which supports seeks, an 1834b88c807SRodney W. Grimes.Xr lseek 2 1844b88c807SRodney W. Grimesoperation is used. 1854b88c807SRodney W. GrimesOtherwise, input data is read and discarded. 1864b88c807SRodney W. GrimesFor pipes, the correct number of bytes is read. 1874b88c807SRodney W. GrimesFor all other devices, the correct number of blocks is read without 1884b88c807SRodney W. Grimesdistinguishing between a partial or complete block being read. 18975e55112SEdward Tomasz Napierala.It Cm speed Ns = Ns Ar n 19075e55112SEdward Tomasz NapieralaLimit the copying speed to 19175e55112SEdward Tomasz Napierala.Ar n 19275e55112SEdward Tomasz Napieralabytes per second. 193c3f5e9c5SXin LI.It Cm status Ns = Ns Ar value 194c3f5e9c5SXin LIWhere 195c3f5e9c5SXin LI.Cm value 196c3f5e9c5SXin LIis one of the symbols from the following list. 1974767c42cSKyle Evans.Bl -tag -width "progress" 198c3f5e9c5SXin LI.It Cm noxfer 199c3f5e9c5SXin LIDo not print the transfer statistics as the last line of status output. 200c3f5e9c5SXin LI.It Cm none 201c3f5e9c5SXin LIDo not print the status output. 202c3f5e9c5SXin LIError messages are shown; informational messages are not. 2034767c42cSKyle Evans.It Cm progress 2044767c42cSKyle EvansPrint basic transfer statistics once per second. 205c3f5e9c5SXin LI.El 20680c7362cSGiorgos Keramidas.It Cm conv Ns = Ns Ar value Ns Op , Ns Ar value ... 2074b88c807SRodney W. GrimesWhere 2084b88c807SRodney W. Grimes.Cm value 2094b88c807SRodney W. Grimesis one of the symbols from the following list. 210aeaef479SEric van Gyzen.Bl -tag -width "unblock" 2114b88c807SRodney W. Grimes.It Cm ascii , oldascii 2124b88c807SRodney W. GrimesThe same as the 2134b88c807SRodney W. Grimes.Cm unblock 2144b88c807SRodney W. Grimesvalue except that characters are translated from 215939a4c24SSteve Price.Tn EBCDIC 2164b88c807SRodney W. Grimesto 2174b88c807SRodney W. Grimes.Tn ASCII 2184b88c807SRodney W. Grimesbefore the 2194b88c807SRodney W. Grimesrecords are converted. 2204b88c807SRodney W. Grimes(These values imply 2214b88c807SRodney W. Grimes.Cm unblock 2224b88c807SRodney W. Grimesif the operand 2234b88c807SRodney W. Grimes.Cm cbs 2244b88c807SRodney W. Grimesis also specified.) 2254b88c807SRodney W. GrimesThere are two conversion maps for 2264b88c807SRodney W. Grimes.Tn ASCII . 2274b88c807SRodney W. GrimesThe value 2284b88c807SRodney W. Grimes.Cm ascii 22980c7362cSGiorgos Keramidasspecifies the recommended one which is compatible with 23080c7362cSGiorgos Keramidas.At V . 2314b88c807SRodney W. GrimesThe value 2324b88c807SRodney W. Grimes.Cm oldascii 2334b88c807SRodney W. Grimesspecifies the one used in historic 23480c7362cSGiorgos Keramidas.At 235753d686dSRuslan Ermilovand 236753d686dSRuslan Ermilov.No pre- Ns Bx 4.3 reno 237753d686dSRuslan Ermilovsystems. 2384b88c807SRodney W. Grimes.It Cm block 2394b88c807SRodney W. GrimesTreats the input as a sequence of newline or end-of-file terminated variable 2404b88c807SRodney W. Grimeslength records independent of input and output block boundaries. 2414b88c807SRodney W. GrimesAny trailing newline character is discarded. 2424b88c807SRodney W. GrimesEach input record is converted to a fixed length output record where the 2434b88c807SRodney W. Grimeslength is specified by the 2444b88c807SRodney W. Grimes.Cm cbs 2454b88c807SRodney W. Grimesoperand. 2464b88c807SRodney W. GrimesInput records shorter than the conversion record size are padded with spaces. 2474b88c807SRodney W. GrimesInput records longer than the conversion record size are truncated. 2484b88c807SRodney W. GrimesThe number of truncated input records, if any, are reported to the standard 2494b88c807SRodney W. Grimeserror output at the completion of the copy. 2504b88c807SRodney W. Grimes.It Cm ebcdic , ibm , oldebcdic , oldibm 2514b88c807SRodney W. GrimesThe same as the 2524b88c807SRodney W. Grimes.Cm block 2534b88c807SRodney W. Grimesvalue except that characters are translated from 2544b88c807SRodney W. Grimes.Tn ASCII 2554b88c807SRodney W. Grimesto 2564b88c807SRodney W. Grimes.Tn EBCDIC 2574b88c807SRodney W. Grimesafter the 2584b88c807SRodney W. Grimesrecords are converted. 2594b88c807SRodney W. Grimes(These values imply 2604b88c807SRodney W. Grimes.Cm block 2614b88c807SRodney W. Grimesif the operand 2624b88c807SRodney W. Grimes.Cm cbs 2634b88c807SRodney W. Grimesis also specified.) 2644b88c807SRodney W. GrimesThere are four conversion maps for 2654b88c807SRodney W. Grimes.Tn EBCDIC . 2664b88c807SRodney W. GrimesThe value 2674b88c807SRodney W. Grimes.Cm ebcdic 2684b88c807SRodney W. Grimesspecifies the recommended one which is compatible with 2694b88c807SRodney W. Grimes.At V . 2704b88c807SRodney W. GrimesThe value 2714b88c807SRodney W. Grimes.Cm ibm 2724b88c807SRodney W. Grimesis a slightly different mapping, which is compatible with the 2734b88c807SRodney W. Grimes.At V 2744b88c807SRodney W. Grimes.Cm ibm 2754b88c807SRodney W. Grimesvalue. 2764b88c807SRodney W. GrimesThe values 2774b88c807SRodney W. Grimes.Cm oldebcdic 2784b88c807SRodney W. Grimesand 2794b88c807SRodney W. Grimes.Cm oldibm 2804b88c807SRodney W. Grimesare maps used in historic 28180c7362cSGiorgos Keramidas.At 282753d686dSRuslan Ermilovand 283753d686dSRuslan Ermilov.No pre- Ns Bx 4.3 reno 284753d686dSRuslan Ermilovsystems. 2853b96efbdSMatt Macy.It Cm fdatasync 2863b96efbdSMatt MacyPerform an 2873b96efbdSMatt Macy.Xr fdatasync 2 2883b96efbdSMatt Macyon the output file before closing it. 289ce1b19d8SMatt Macy.It Cm fsync 290ce1b19d8SMatt MacyPerform an 291ce1b19d8SMatt Macy.Xr fsync 2 292ce1b19d8SMatt Macyon the output file before closing it. 2934b88c807SRodney W. Grimes.It Cm lcase 2944b88c807SRodney W. GrimesTransform uppercase characters into lowercase characters. 2956a3d33acSPoul-Henning Kamp.It Cm pareven , parnone , parodd , parset 2966a3d33acSPoul-Henning KampOutput data with the specified parity. 2976a3d33acSPoul-Henning KampThe parity bit on input is stripped unless 2986a3d33acSPoul-Henning Kamp.Tn EBCDIC 2996a3d33acSPoul-Henning Kampto 3006a3d33acSPoul-Henning Kamp.Tn ASCII 3016a3d33acSPoul-Henning Kampconversions is also specified. 3024b88c807SRodney W. Grimes.It Cm noerror 3034b88c807SRodney W. GrimesDo not stop processing on an input error. 3044b88c807SRodney W. GrimesWhen an input error occurs, a diagnostic message followed by the current 3054b88c807SRodney W. Grimesinput and output block counts will be written to the standard error output 3064b88c807SRodney W. Grimesin the same format as the standard completion message. 3074b88c807SRodney W. GrimesIf the 3084b88c807SRodney W. Grimes.Cm sync 3094b88c807SRodney W. Grimesconversion is also specified, any missing input data will be replaced 3104b88c807SRodney W. Grimeswith 31180c7362cSGiorgos Keramidas.Dv NUL 3124b88c807SRodney W. Grimesbytes (or with spaces if a block oriented conversion value was 3134b88c807SRodney W. Grimesspecified) and processed as a normal input buffer. 3144b88c807SRodney W. GrimesIf the 315e3edab4aSRobert Watson.Cm fillchar 3166fa13ec0SRuslan Ermilovoption is specified, the fill character provided on the command line 3176fa13ec0SRuslan Ermilovwill override 3186fa13ec0SRuslan Ermilovthe automatic selection of the fill character. 319e3edab4aSRobert WatsonIf the 3204b88c807SRodney W. Grimes.Cm sync 3214b88c807SRodney W. Grimesconversion is not specified, the input block is omitted from the output. 3224b88c807SRodney W. GrimesOn input files which are not tapes or pipes, the file offset 3234b88c807SRodney W. Grimeswill be positioned past the block in which the error occurred using 3244b88c807SRodney W. Grimes.Xr lseek 2 . 3254b88c807SRodney W. Grimes.It Cm notrunc 3264b88c807SRodney W. GrimesDo not truncate the output file. 3274b88c807SRodney W. GrimesThis will preserve any blocks in the output file not explicitly written 3284b88c807SRodney W. Grimesby 329be8b1497SRuslan Ermilov.Nm . 3304b88c807SRodney W. GrimesThe 3314b88c807SRodney W. Grimes.Cm notrunc 3324b88c807SRodney W. Grimesvalue is not supported for tapes. 3334b88c807SRodney W. Grimes.It Cm osync 3344b88c807SRodney W. GrimesPad the final output block to the full output block size. 3354b88c807SRodney W. GrimesIf the input file is not a multiple of the output block size 3364b88c807SRodney W. Grimesafter conversion, this conversion forces the final output block 3374b88c807SRodney W. Grimesto be the same size as preceding blocks for use on devices that require 3384b88c807SRodney W. Grimesregularly sized blocks to be written. 3394b88c807SRodney W. GrimesThis option is incompatible with use of the 34080c7362cSGiorgos Keramidas.Cm bs Ns = Ns Ar n 3414b88c807SRodney W. Grimesblock size specification. 3424ddfeabdSJoerg Wunsch.It Cm sparse 3434ddfeabdSJoerg WunschIf one or more output blocks would consist solely of 34480c7362cSGiorgos Keramidas.Dv NUL 3454ddfeabdSJoerg Wunschbytes, try to seek the output file by the required space instead of 3464ddfeabdSJoerg Wunschfilling them with 34780c7362cSGiorgos Keramidas.Dv NUL Ns s , 3484ddfeabdSJoerg Wunschresulting in a sparse file. 3494b88c807SRodney W. Grimes.It Cm swab 3504b88c807SRodney W. GrimesSwap every pair of input bytes. 3514b88c807SRodney W. GrimesIf an input buffer has an odd number of bytes, the last byte will be 3524b88c807SRodney W. Grimesignored during swapping. 3534b88c807SRodney W. Grimes.It Cm sync 3544b88c807SRodney W. GrimesPad every input block to the input buffer size. 3554b88c807SRodney W. GrimesSpaces are used for pad bytes if a block oriented conversion value is 3564b88c807SRodney W. Grimesspecified, otherwise 35780c7362cSGiorgos Keramidas.Dv NUL 3584b88c807SRodney W. Grimesbytes are used. 3594b88c807SRodney W. Grimes.It Cm ucase 3604b88c807SRodney W. GrimesTransform lowercase characters into uppercase characters. 3614b88c807SRodney W. Grimes.It Cm unblock 3624b88c807SRodney W. GrimesTreats the input as a sequence of fixed length records independent of input 3634b88c807SRodney W. Grimesand output block boundaries. 3644b88c807SRodney W. GrimesThe length of the input records is specified by the 3654b88c807SRodney W. Grimes.Cm cbs 3664b88c807SRodney W. Grimesoperand. 3674b88c807SRodney W. GrimesAny trailing space characters are discarded and a newline character is 3684b88c807SRodney W. Grimesappended. 3694b88c807SRodney W. Grimes.El 3704b88c807SRodney W. Grimes.El 3714b88c807SRodney W. Grimes.Pp 37275e55112SEdward Tomasz NapieralaWhere sizes or speed are specified, a decimal, octal, or hexadecimal number of 373276d5ee8SGregory Sutterbytes is expected. 37480c7362cSGiorgos KeramidasIf the number ends with a 37580c7362cSGiorgos Keramidas.Dq Li b , 37680c7362cSGiorgos Keramidas.Dq Li k , 37780c7362cSGiorgos Keramidas.Dq Li m , 37880c7362cSGiorgos Keramidas.Dq Li g , 379e53d0abfSEdward Tomasz Napierala.Dq Li t , 380e53d0abfSEdward Tomasz Napierala.Dq Li p , 38180c7362cSGiorgos Keramidasor 38280c7362cSGiorgos Keramidas.Dq Li w , 38380c7362cSGiorgos Keramidasthe 384e53d0abfSEdward Tomasz Napieralanumber is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G), 385e53d0abfSEdward Tomasz Napierala1099511627776 (1T), 1125899906842624 (1P) 38654946e00SBrian Feldmanor the number of bytes in an integer, respectively. 38780c7362cSGiorgos KeramidasTwo or more numbers may be separated by an 38880c7362cSGiorgos Keramidas.Dq Li x 38980c7362cSGiorgos Keramidasto indicate a product. 3904b88c807SRodney W. Grimes.Pp 3914b88c807SRodney W. GrimesWhen finished, 392cbf6f7d3SPhilippe Charnier.Nm 3934b88c807SRodney W. Grimesdisplays the number of complete and partial input and output blocks, 3944b88c807SRodney W. Grimestruncated input records and odd-length byte-swapping blocks to the 3954b88c807SRodney W. Grimesstandard error output. 3964b88c807SRodney W. GrimesA partial input block is one where less than the input block size 3974b88c807SRodney W. Grimeswas read. 3984b88c807SRodney W. GrimesA partial output block is one where less than the output block size 3994b88c807SRodney W. Grimeswas written. 4004b88c807SRodney W. GrimesPartial output blocks to tape devices are considered fatal errors. 4014b88c807SRodney W. GrimesOtherwise, the rest of the block will be written. 4024b88c807SRodney W. GrimesPartial output blocks to character devices will produce a warning message. 4034b88c807SRodney W. GrimesA truncated input block is one where a variable length record oriented 4044b88c807SRodney W. Grimesconversion value was specified and the input line was too long to 4054b88c807SRodney W. Grimesfit in the conversion record or was not newline terminated. 4064b88c807SRodney W. Grimes.Pp 4074b88c807SRodney W. GrimesNormally, data resulting from input or conversion or both are aggregated 4084b88c807SRodney W. Grimesinto output blocks of the specified size. 4094b88c807SRodney W. GrimesAfter the end of input is reached, any remaining output is written as 4104b88c807SRodney W. Grimesa block. 4114b88c807SRodney W. GrimesThis means that the final output block may be shorter than the output 4124b88c807SRodney W. Grimesblock size. 4134b88c807SRodney W. Grimes.Pp 4144b88c807SRodney W. GrimesIf 415cbf6f7d3SPhilippe Charnier.Nm 4164b88c807SRodney W. Grimesreceives a 4174b88c807SRodney W. Grimes.Dv SIGINFO 41880c7362cSGiorgos Keramidas(see the 41980c7362cSGiorgos Keramidas.Cm status 42080c7362cSGiorgos Keramidasargument for 4214b88c807SRodney W. Grimes.Xr stty 1 ) 4224b88c807SRodney W. Grimessignal, the current input and output block counts will 4234b88c807SRodney W. Grimesbe written to the standard error output 4244b88c807SRodney W. Grimesin the same format as the standard completion message. 4254b88c807SRodney W. GrimesIf 426cbf6f7d3SPhilippe Charnier.Nm 4274b88c807SRodney W. Grimesreceives a 4284b88c807SRodney W. Grimes.Dv SIGINT 4294b88c807SRodney W. Grimessignal, the current input and output block counts will 4304b88c807SRodney W. Grimesbe written to the standard error output 4314b88c807SRodney W. Grimesin the same format as the standard completion message and 432cbf6f7d3SPhilippe Charnier.Nm 4334b88c807SRodney W. Grimeswill exit. 4346fca4c7cSRuslan Ermilov.Sh EXIT STATUS 4356fca4c7cSRuslan Ermilov.Ex -std 4366a3d33acSPoul-Henning Kamp.Sh EXAMPLES 4376a3d33acSPoul-Henning KampCheck that a disk drive contains no bad blocks: 4382360f509SRuslan Ermilov.Pp 43905d98029SSergey Kandaurov.Dl "dd if=/dev/ada0 of=/dev/null bs=1m" 4406a3d33acSPoul-Henning Kamp.Pp 4416a3d33acSPoul-Henning KampDo a refresh of a disk drive, in order to prevent presently 4426a3d33acSPoul-Henning Kamprecoverable read errors from progressing into unrecoverable read errors: 4436a3d33acSPoul-Henning Kamp.Pp 44405d98029SSergey Kandaurov.Dl "dd if=/dev/ada0 of=/dev/ada0 bs=1m" 4452360f509SRuslan Ermilov.Pp 4462360f509SRuslan ErmilovRemove parity bit from a file: 4472360f509SRuslan Ermilov.Pp 4482360f509SRuslan Ermilov.Dl "dd if=file conv=parnone of=file.txt" 4496a3d33acSPoul-Henning Kamp.Pp 4506a3d33acSPoul-Henning KampCheck for (even) parity errors on a file: 4512360f509SRuslan Ermilov.Pp 4522360f509SRuslan Ermilov.Dl "dd if=file conv=pareven | cmp -x - file" 4534dd47928SGiorgos Keramidas.Pp 4544dd47928SGiorgos KeramidasTo create an image of a Mode-1 CD-ROM, which is a commonly used format 4554dd47928SGiorgos Keramidasfor data CD-ROM disks, use a block size of 2048 bytes: 4564dd47928SGiorgos Keramidas.Pp 457c650c2f3SAlex Kozlov.Dl "dd if=/dev/cd0 of=filename.iso bs=2048" 45856fd1284SWarner Losh.Pp 45956fd1284SWarner LoshWrite a filesystem image to a memory stick, padding the end with zeros, 46056fd1284SWarner Loshif necessary, to a 1MiB boundary: 46156fd1284SWarner Losh.Pp 46256fd1284SWarner Losh.Dl "dd if=memstick.img of=/dev/da0 bs=1m conv=noerror,sync" 4634b88c807SRodney W. Grimes.Sh SEE ALSO 4644b88c807SRodney W. Grimes.Xr cp 1 , 4654b88c807SRodney W. Grimes.Xr mt 1 , 466e6588b17SDavid E. O'Brien.Xr recoverdisk 1 , 467fd525b85SScott Long.Xr tr 1 , 468fd5795b2SEdward Tomasz Napierala.Xr geom 4 , 469fd5795b2SEdward Tomasz Napierala.Xr trim 8 4704b88c807SRodney W. Grimes.Sh STANDARDS 4714b88c807SRodney W. GrimesThe 472cbf6f7d3SPhilippe Charnier.Nm 4734b88c807SRodney W. Grimesutility is expected to be a superset of the 4744b88c807SRodney W. Grimes.St -p1003.2 4754b88c807SRodney W. Grimesstandard. 4764b88c807SRodney W. GrimesThe 4774b88c807SRodney W. Grimes.Cm files 478c3f5e9c5SXin LIand 479c3f5e9c5SXin LI.Cm status 480c3f5e9c5SXin LIoperands and the 4814b88c807SRodney W. Grimes.Cm ascii , 4824b88c807SRodney W. Grimes.Cm ebcdic , 4834b88c807SRodney W. Grimes.Cm ibm , 4844b88c807SRodney W. Grimes.Cm oldascii , 4854b88c807SRodney W. Grimes.Cm oldebcdic 4864b88c807SRodney W. Grimesand 4874b88c807SRodney W. Grimes.Cm oldibm 4884b88c807SRodney W. Grimesvalues are extensions to the 489e27480d6SRuslan Ermilov.Tn POSIX 4904b88c807SRodney W. Grimesstandard. 4912a19a3f5SSevan Janiyan.Sh HISTORY 4922a19a3f5SSevan JaniyanA 4932a19a3f5SSevan Janiyan.Nm 4942a19a3f5SSevan Janiyancommand appeared in 4952a19a3f5SSevan Janiyan.At v5 . 4967b020a2fSRuslan Ermilov.Sh BUGS 4977b020a2fSRuslan ErmilovProtection mechanisms in the 4987b020a2fSRuslan Ermilov.Xr geom 4 4997b020a2fSRuslan Ermilovsubsystem might prevent the super-user from writing blocks to a disk. 5009358c0e3SGiorgos KeramidasInstructions for temporarily disabling these protection mechanisms can be 5017b020a2fSRuslan Ermilovfound in the 5027b020a2fSRuslan Ermilov.Xr geom 4 5037b020a2fSRuslan Ermilovman page. 504