A Bash Script to Create a Bootable USB from ISO in Linux

Bootiso is a powerful Bash script to easily and securely create a bootable USB device from one ISO file. It helps you create a bootable USB from an ISO with a single command from the terminal. It is a well tailored script that carefully organized and validated using shellcheck.

It has to be run with root authority, and if external programs it requires are not available on your system, it will ask you to install them and exits. Bootiso checks that the selected ISO has the correct mime-type, otherwise it exits. To prevent system damages, it ensures that the selected device is connected only via USB.

Read Also: 3 Ways to Extract and Copy Files from ISO Image in Linux

Before formating and partitioning your USB device, it prompts you to accept execution of the actions to prevent any data loss. Importantly, it manages any failure from an internal command appropriately exits. In addition, it performs a cleanup of any temporary files on exit by employing the trap utility.

Install Bootiso Script in Linux

The easy way to install bootiso from sources is to clone the git repository and set execute permission as shown.

$ git clone https://github.com/jsamr/bootiso.git
$ cd bootiso/
$ chmod +x bootiso

Next, move the script to a bin path (for example ~/bin/ or /usr/local/bin/) to run it like any other Linux commands on your system.

$ mv bootiso ~/bin/

Once installed, the syntax for running bootiso is to provide the ISO as first argument.

$ bootiso myfile.iso

To create a bootable USB device from ISO file, first you need to list all available USB drives attached to your system using the -l flag as shown.

$ bootiso -l

Listing USB drives available in your system:
sdb           1   14.9G running disk

Next, to make the device (/dev/sdb) as a bootable device, simply provide the ISO as the first argument. Note that if there is only one USB device attached to the system (as in the case above), the script will automatically select it, otherwise, it will ask you to select from an auto-generated list of all attached USB drives.

$ sudo bootiso ~/Templates/eXternOS.iso 
Create Bootable USB in Linux Terminal

Create Bootable USB in Linux Terminal

You may also use the -a flag to enable autoselecting USB drives in conjunction with -y (disables prompting user before formating USB drive) option as shown.

$ sudo bootiso -a -y ~/Templates/eXternOS.iso

If you have multiple USB devices connected to the system, you can use the -d flag to explicitly specify the USB device you want to make bootable from the command line as shown.

$ sudo bootiso -d /dev/sdb ~/Templates/eXternOS.iso  

By default, bootiso uses mount + rsync to employ dd command instead, add the --dd flag as shown.

$ sudo bootiso --dd -d ~/Templates/eXternOS.iso      

In addition, for non-hybrid ISOs, you can install a bootloader with syslinux with the -b option, as follows. This option however does not support the dd command.

$ sudo bootiso -b /ptah/to/non-hybrid/file.iso
$ sudo bootiso -bd /usb/device /ptah/to/non-hybrid/file.iso

For more information on other bootiso capabilities and options, see the help message.

$ bootiso -h  

Bootiso Github repository: https://github.com/jsamr/bootiso

That’s It! Bootiso is a powerful Bash script to easily and securely create a bootable USB device from one ISO file, with a single command on the terminal. Use the comment form below to share your thoughts about it or ask questions.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

17 Responses

  1. isnurmi says:

    You never mention numerous dependencies that bootiso in fact requires and which are the pain in the neck to provide. It would be nice to check for them on the user side and point to where they can be obtained ( and installed !)

  2. newdev4ios says:

    Can I make the script format the usb to ntfs while installing the iso?

    I’ve tried:

    bootiso [-f -t ntfs] isofile.iso — still does fat32
    bootiso [-f] [-t] [ntfs] isofile.iso — still does fat32
    bootiso -f [-t ntfs] isofile.iso — fail saying format action doesn’t require any arguments
    bootiso -f -t ntfs — formats to iso but doesn’t install iso
    bootiso isofile.iso — formats fat32 –if you can direct me to where it defaults to the fat32 so i can change the default to ntfs instead of fat32 that would also work for me
    bootiso [-t] [ntfs] isofile.iso — fail: bash: -f: No such file or directory

    Can’t seem to get the script to create an ntfs formatted bootable usb drive.

  3. Jules Samuel Randolph says:

    Version 3 is out [with many improvements :-) https://github.com/jsamr/bootiso/releases/tag/v3.0.0

    Notably, it now inspects ISO file to check if it’s hybrid. When it’s not, it looks for UEFI and SYSLINUX boot capabilities. After which, it chooses the best install mode (dd or mount+rsync) and eventually installs SYSLINUX.

    So you basically don’t need to care anymore about rsync or dd mode, just run `bootiso myfile.iso’ and it will work, even with rescue CDs such as UltimateBootCD.

  4. Pim Dennendal says:

    Surely you should put it in /sbin, /usr/sbin, etc. If it is root only, it should be there.

  5. ivank2139 says:

    Very well done and professional. I used dd before but this will make it a little more bulletproof.

  6. Herald says:

    Why not to use dd?

    # dd if=/dev/sdb of=yourimage.iso bs=1m

    You don’t need install and setting any other app, dd is out of box.

    • Aaron Kili says:


      The main aim of this script is to provide a secure way of creating bootable devices, which you can not achieve by running this dd command only. Using this dd command, you can accidentally provide your root partition or any other important partition output device, which can lead to data loss; in simple terms the dd command only, can not check that your output device is a USB or not.

      Secondly, using dd command, you will not be prompted before formating of the output device, which may also lead to data loss in case you have not backed up data on that device. This script is a much better option because it securely prepares your USB device before moving files on it, and any internal errors are reported.

    • Jules Samuel Randolph says:

      As a side note, dd only works for hybrid ISO’s. bootiso works with any ISO, given the “-b” option to install a syslinux bootloader.

      • Aaron Kili says:


        This actually sheds more light on why bootiso is far much better a option than using dd only for making a bootable USB from the command-line. Thanks for the addition.

Leave a Reply to Herald Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.