Bonus! Shrinking Images

Once you read an image from as SD card, it'll be the full 4 or 8 G, which may be way more than the actual data storage size. This script, which you can download run as "script.sh pi.img" on the image will resize the binary file

https://gist.github.com/toddtreece/56c16aa06905998d7c94d638cc9cd5fb
This guide was first published on May 30, 2016. It was last updated on Dec 10, 2018. This page (Bonus! Shrinking Images) was last updated on Oct 18, 2016.