dd to split file
By Pierre-Alain B on Sunday, October 23 2016, 13:42 - Permalink
dd is one these magical GNU tools for which you can always find new usage! I recently discovered that dd could be used to split files:
dd if=~/input_file bs=1M skip=50 count=1000 iflag=skip_bytes,count_bytes of=~/output_file status=none
in details and with no surprise:
- if for the input file
- of for the output file
- bs for the block size
- skip to indicate the starting point in the input file
- count to indicate the length of the file to copy
- status=none is optional, it is used to make dd quiet
- iflag is important as it gives important parameters to dd in this case:
- skip_bytes forces dd to understand the skip parameter in bytes (and not blocks)
- count_bytes forces dd to understand the count parameter in bytes (and not blocks)
Always useful!