Skip to content

Instantly share code, notes, and snippets.

@xtolid
Last active December 18, 2017 00:01
Show Gist options
  • Save xtolid/a9a68b4ef0ee81c9d7ab3946f5198a0a to your computer and use it in GitHub Desktop.
Save xtolid/a9a68b4ef0ee81c9d7ab3946f5198a0a to your computer and use it in GitHub Desktop.
DD .iso to USB

I like using DD to write .iso files to USB drives, but I'm terrible and remembering the command. This a script I put together that lists the devices available, and prompts a choice for device and image to be used. Afterwards, it unmounts the drive so I can safely remove it and try it out.

#!/bin/bash
lsblk
read -e -p "Enter path of drive to be imaged. " DRIVEPATH
read -e -p "Enter path to ISO. " ISOPATH
dd bs=4M if=$ISOPATH of=$DRIVEPATH && sync
umount $DRIVEPATH

Please exercise caution when using this script. DD won't think twice about writing over your data if instructed to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment