dd if=/dev/zero of=/dev/null
dd
performs block level I/O, as opposed to filesystem-level I/O, for increased performancefread
, fwrite
, etc.)dd
if=FILE
: read from FILE
instead of stdin
of=FILE
: write to FILE
instead of stdout
bs=BYTES
: bs
is the block size; read and write up to BYTES
bytes at a time (default: 512);count=N
: copy only N input blocksseek=N
: skip N
obs-sized blocks at start of outputskip=N
: skip N
ibs-sized blocks at start of input-i <file>
: input file (defaults to stdin)-o <file>
: output file (defaults to stdout)-b <size>
: block size, the number of bytes copied at a time (defaults to 512)-c <count>
: total number of blocks copied (defaults to the entire file)-p <count>
: number of blocks to skip at the start of the input file (defaults to 0)-k <count>
: number of blocks to skip at the start of the output file (defaults to 0)getopt()
getopt(argc, argv, "i:o:b:c:p:k:")
./dd -i input_file -o output_file -b 256
-> specifies a block size of 256 bytes