Create a Bootable USB Stick from the Ubuntu Terminal

Why do you need a bootable USB stick under Ubuntu? Here are some possible reasons:

  1. You can use a bootable USB Stick to install or upgrade Ubuntu.
  2. A different Ubuntu flavor can be run directly from a USB stick.
  3. You can use the USB stick to fix configuration problems with the standard tools that come with the Ubuntu ISO package

There are many ways to create a bootable USB stick in Ubuntu. Some involve using the system tools, while others require external packages to be installed. In this article, we will use the Ubuntu command line, the terminal, to create a bootable Ubuntu USB stick. This is done with the dd command. The terminal is a good alternative to doing your tasks through the Ubuntu user interface. Using the terminal makes certain tasks more efficient and even faster. The command-line tools don't consume too many resources, so they are a good alternative to the widely used graphical applications, especially if you can't cope with older hardware.

We have run the commands and procedures mentioned in this article on an Ubuntu 20.04 LTS system.

Please follow these steps in order to create a bootable Ubuntu USB from your terminal.

Step 1: Download the Ubuntu ISO file

Open the Official Ubuntu website through any installed web browser and download the Ubuntu ISO through the following download link:

https://ubuntu.com/download/server

Click on any Ubuntu version you want to install. I've been using the "Download Ubuntu Server 20.04 LTS" link under Ubuntu Server. This will open the dialog to save the file. Select the Save file option and then click OK. The .iso package will be saved in your downloads folder.

The direct download link at the time of writing this guide was: https://releases.ubuntu.com/20.04.2/ubuntu-20.04.2-live-server-amd64.iso

Step 2: Open Ubuntu Terminal

Open your Ubuntu command line, the Terminal, either through the Ubuntu Application Launcher search or by using the Ctrl+Alt+T shortcut.

Open the Ubuntu Terminal

Step 3: Unmount the USB if it is mounted

Before you write your USB stick, you need to make sure that it is not automatically mounted to your Ubuntu. Insert the USB into your system and then run the following command in order to fetch your USB’s name:

$ df

The last line in the output of my df command lists the USB that is mounted to my Ubuntu system.

Note down the device name (/dev/sdb1 in my case) and the path it is mounted on (/media/sana/Ubuntu-Server 20.04.2 LTS amd64 in my case).

There are two ways you can unmount the USB from your Ubuntu:

1. By using the path your USB is mounted on:

$ sudo umount /path/where/mounted

For example, I would use the following path to unmount the USB:

$ sudo umount /media/sana/'Ubuntu-Server 20.04.2 LTS amd64'

2. You can also use the device name to unmount it:

$ sudo umount /device/name

For example, I would use the following device name to unmount the USB:

$ sudo umount /dev/sdb1

Step 4: Create a bootable Ubuntu stick

Now that you have unmounted the USB, you know your ISO image’s name and path, and you know your device name, it takes only one command to create a bootable USB. This is the dd command syntax you can use in your Terminal:

$ sudo dd bs=4M if=/path/to/ISOfile of=/dev/sdx status=progress oflag=sync

Tip: Instead of typing the command, you can copy it from here and paste into the Terminal by using the Ctrl+Shift+V, or by using the Paste option from the right-click menu.

I will be using the following command to write the Ubuntu ISO on my USB stick:

$ sudo dd bs=4M if=/home/sana/Downloads/ubuntu-20.04.2-live-server-amd64.iso of=/dev/sdb1 status=progress oflag=sync

The dd command starts writing the ISO file to your USB stick and displays a status bar.

After a few minutes, your bootable USB stick with the Ubuntu ISO on it is ready.

Of the many ways to create a bootable USB stick, we looked at the Terminal application for this purpose. I'm sure you've seen that it doesn't require any additional application to be installed and it takes much less time than some UI applications. Through this and many other examples, I've recently become an advocate of preferring the command line over the UI, even for people who aren't very familiar with terminal commands. For this very reason, I'll try to explain the process as simply as possible.