sudo dd if=myfile.img of=/path/to/drive bs=1M
One thing worth noting though is that /path/to/drive should not include any partition number. An example path would be something like:
Note that writing large images can take a good deal of time depending on the speed of your drive and that this command will not give you any feedback until it finishes.
Now, perhaps you are like myself and have some interest in creating/distributing .IMG files of your own. Creating image files is also fairly easily and uses the same dd command. An example of how to create an image file is:
sudo dd if=/path/to/drive of=image.img
Note that this command copies the entire contents of the drive - meaning if your drive is large your .IMG file will be equally large! Now, what do you do if you only want to copy part of your drive? Simply add one argument to the above command of course! For example to only copy the first two gigs of data on a drive to a .IMG file use:
sudo dd if=/path/to/drive of=image.img bs=2048 count=1M
I am by no means an expert at using dd, but if you run into any issues feel free to drop a comment below and I'll do my best to help you out.