Sample Header Ad - 728x90

Remove null bytes from the end of a large file

6 votes
6 answers
9863 views
I just backed up the microSD card from my Raspberry Pi on my PC running a Linux distro using this command: dd if=/dev/sdx of=file.bin bs=16M The microSD card is only 3/4 full so I suppose there's a few gigs of null bytes at the end of the tremendous file. I am very sure I don't need that. How can I strip those null bytes from the end efficiently so that I can later restore it with this command? cat file.bin /dev/zero | dd of=/dev/sdx bs=16M
Asked by iBug (3638 rep)
Jan 13, 2018, 08:37 AM
Last activity: May 5, 2022, 06:05 AM