Skip to content

Instantly share code, notes, and snippets.

@byteshiva
Created March 16, 2017 12:45
Show Gist options
  • Save byteshiva/ebedab43b709c8bddfed16b4454a14b0 to your computer and use it in GitHub Desktop.
Save byteshiva/ebedab43b709c8bddfed16b4454a14b0 to your computer and use it in GitHub Desktop.
copy large files using dd command
dd if=/dev/zero of=CREATE_TEST_FILE bs=1k count=4700000
@byteshiva
Copy link
Author

  1. Converting data formats.
    a. Convert the data format of a file from ASCII to EBCDIC.
dd if=textfile.ascii of=textfile.ebcdic conv=ebcdic

b. Convert the data format of a file from EBCDIC to ASCII

dd if=textfile.ebcdic of=textfile.ascii conv=ascii

@byteshiva
Copy link
Author

  1. Converting case of a file.
    a. Converting a file to uppercase.
dd if=file1 of=file2 conv=ucase

b. Converting a file to lowercase.

dd if=file1 of=file2 conv=lcase

@byteshiva
Copy link
Author

  1. Creating or modifying data files.

a. Create a fixed size, say 10MB file.

dd if=/dev/zero of=file1 bs=10485760 count=1

The block size is calculated as 10MB=1010241024.

b. Modify the first 512 bytes of a file with null data.

dd if=/dev/zero of=file1 bs=512 count=1 conv=notrunc

The option ‘notrunc’ refers to do not truncate the file, only replace the first 512 bytes, if it exists. Otherwise, you will get a 512 byte file.

@byteshiva
Copy link
Author

byteshiva commented Mar 16, 2017

parallel faster data transmission form machine 1 to machine 2

bbcp -P 2 -w 2M -s 10 my.big.file dest@dest-ip-addr:/tmp/
  1. http://www.slac.stanford.edu/~abh/bbcp/
  2. http://intermediatesql.com/linux/scrap-the-scp-how-to-copy-data-fast-using-pigz-and-nc/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment