As you might already know, if you want to install a brand new Linux distribution such as Debian or a lightweight OS on your computer’s hard drive, you will need to burn its disk image.
Whenever an ISO file is involved, chances are you will have to burn it on a pen drive (unless you use a virtual machine to try out your disk image). There is an ITgirl.tech article on how to burn ISO files on your Linux computer using tools native to your operating system and third-party software. However, if you are reading the present article, chances are you’re looking for a different way of doing things, namely by using the command line.
More often than not, we use dedicated software applications on our computers and burning an ISO file on a USB key is no exception to this rule. It is natural to think that the easiest way of doing this process is through the use of graphical software. After all, we’re accustomed to our laptop or desktop computer displaying an interactive visual interface. However, sometimes there’s no way around using the command line to get the results we want. Some operating systems (such as macOS Mojave and virtually all Linux distributions) even make using the command-line the most efficient way of burning an ISO file on your pen drive.
The advantages of using the Linux Terminal
Many seasoned Linux users already know the value of using the Terminal. However, if you are new to this operating system, you might still have a lukewarm opinion on this old school way of doing things.
However, unlike dedicated applications, the Terminal is a tool that doesn’t require to install additional components. It is also a great alternative to fall back on when you eventually end up with a program that seems to have a mind of its own. The streamlined process of being able to execute simple commands in a matter of seconds using the always readily-available Terminal is sometimes a real breath of fresh air when you’ve spent the last hour browsing forums trying to troubleshoot your new software. Moreover, there’s also something to be said about the knowledge one acquires by learning to use the command line, even to execute the most basic commands; getting to know the command line not only makes you understand the technology behind your OS better, but it also gives you a set of transferable skills that will always be useful whatever computer you end up using.
Also, as always, remember to format your pen drive before burning your ISO file on it!
So without any further due, here’s how to use the command line to burn an ISO file on your pen drive from Linux.
How to burn a disk image on your pen drive from the Linux Terminal
Unlike with Mac and Windows operating systems, Linux OS makes it so that the default way of doing most processes is more often than not through the command line.
There exist Linux GUI (Graphical User Interface) options for practically anything under the sun, ISO burning tools included. That is because most users feel more comfortable spending the majority of their time interacting with software applications rather than use the Terminal.
However, it is simple to burn a disk image using the command-line. Its process is a streamlined one that is worth learning. Knowing this procedure is also especially useful, as its execution works across all Linux distributions. This fact saves you the headache of having to find a disk image burning software that is compatible out-of-the-box with your specific Linux distro.
There is however one major exception to this rule: burning a Windows 10 iso image. Unlike with other ISO files, creating a bootable pen drive with Windows 10 requires specific steps that you don’t need to do for any other operating system nor software disk image. Seeing as the process is somewhat lengthy whether you choose to do it using mostly the command line or with the help of GUI, there isn’t any advantage to using one method over the other. A handy guideline on how to burn the Windows 10 ISO file (either using GUI or the command line) is available HERE.
For everything else, here are the steps required to burn a disk image on a USB key from Linux.
You will need:
- A pen drive with enough storage space to accommodate your disk image
- Access to the Terminal
Download your ISO of choice. If you’re interested in trying out a different Linux distribution, take a look at THIS article on lightweight Linux distributions. If instead, you’d rather get a feel for the procedure and wish to use an ISO file that you can download rapidly, I recommend Damn Small Linux (around 50 MB).
Access the Terminal (each Linux distribution has a dedicated Terminal version, which can be easily found either as an icon in the taskbar on within the main programs displayed on the main menu).
Identify the drive assigned to your USB key by entering the following command:
This command will show a list of all the hard drives found on your machine, including the pen drives. You can then easily associate each name with its drive by looking at the size and partitioning of each one. As a general rule, the internal drive reserves the “sda” name and leaves the USB keys with names such as “sdb” or “sdc.” Depending on the number of hard drives you have and their particular type, your USB keys might fall down the list to “sdc” or even lower.
Now that you know the name of your USB key make sure that it is unmounted. If it isn’t, type:
$ sudo umount /dev/<YourDrive>
Where <YourDrive> is the name of your pen drive, as found with the “lsblk” command.
Access the location of your ISO file directory. If you are unsure of its specific location path, you can find it by right-clicking on the file and looking at its properties. You will find the full path. You can then copy it and paste it in the Terminal. Type the following:
$ cd /path/to/your/isofile
Using the example above, I would type “cd /home/lari/Downloads”
Now that you are within the folder containing your disk image, it is time to burn the disk image. Enter the following command:
sudo dd bs=4M if=<file.iso> of=/dev/sd<?> conv=fdatasync
Where you replace <file.iso> with the full name of your ISO file and <?> with the letter of your USB key.
Using the example above as a reference, I would type “sudo dd bs=4M if=dsl-4.11.rc1.iso of=/dev/sdb conv=fdatasync”. If you do that, your drive will not boot. Make sure not to include any number following your drive identifier (sdb, sdc, etc.). Also note that I didn’t enter “sudo” as I was already working from root (yes, I like to live dangerously).
After typing the command and pressing Enter, wait. Unlike with regular software tools used to burn ISO files, the command line doesn’t give any indication that it is doing anything while burning the disk image; the Terminal will show no status bar, no percentage, nothing. Instead, after executing the command and pressing Enter, you will be left with a blank line. Do not do anything. After a couple of minutes (the time will vary depending on the size of your disk image), the process will be complete, and you will see a written recap of what just happened.
In this example, the written recap looks like this:
12+1 records in
12+1 records out
53108736 bytes (53 MB, 51 MB) copied, 9.37553 s, 5.7 MB/s
A great way of confirming that everything went as planned is to review the amount indicated next to “records in” and “records out”; they should be the same.
You can exit the Terminal. Your USB key is now ready to boot your disk image.
Does the USB key matter when you burn a disk image?
You can use any old pen drive laying around to burn a disk image. However, as with most things tech-related, the better the hardware, the easier the process. For instance, the type of USB you choose (USB 2.0 vs. USB 3.0 vs. USB 3.1) will have an impact on the data transfer speed. The brand you opt for (e.g., a free pen drive received as a promotional item from your dentist vs. a SanDisk USB flash drive) will also have an impact. The better recognized the brand and the better its hardware reputation, the fewer chances you will have of having your electronics fail on you at a critical time.
If you are interested in Linux, then you might also be a gadget-geek like me. As we are talking about a USB flash drive procedure, I figured why not add some high-tech pen drives recommendations to this article.
Initially, I wanted to add both a SanDisk option and a Kingston Digital one, as usually the latter is often considered a more economical alternative to the former. However, upon searching multiple USB flash drive reviews on Amazon, I no longer felt comfortable recommending a high-end 3.1 SanDisk pen drive. As such, you will instead find two options: a Corsair USB 3.1 pen drive, and a Kingston Digital USB 3.1 pen drive.
Corsair is not generally the first brand that pops in mind when thinking USB flash drives. Instead, people usually associate Corsair with their RAM products. I’ve had the opportunity to buy four Corsair Vengeance memory kits for my custom-built PC and can vouch for this brand’s high-quality standards.
I have not personally tested these USB keys. However, I feel confident about their performance judging by the numerous, well-detailed reviews available for these particular models. As always, YMMV. These flash drives are for those that are looking for some serious performance from their electronics. If instead, you are looking for something a bit more economical (while still being high-quality), I will refer you to the USB keys listed in THIS ARTICLE.
Kingston Digital HyperX Savage 64GB USB Flash Drive 3.1/3.0 350MB/s R, 180MB/s W (HXS3/64GB)
Corsair Flash Voyager GTX 128GB USB 3.1 Premium Flash Drive
Note that the two links posted above are affiliate links. If you go through them to make a purchase, I will earn a commission (at no cost to you). I link these companies and their products because of their quality and not because of the commission I receive from your purchases. These links are used to pay for the cost and upkeep of ITgirl.tech. Thank you!