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