How to create a bootable USB flash drive from an Ubuntu terminal

You might want to create a bootable Ubuntu flash drive yourself for various reasons. Some of these reasons:

  • Install / Update Ubuntu
  • Get Ubuntu desktop experience without affecting your system configuration
  • Using a USB drive to troubleshoot a configuration problem using the standard tools provided with the Ubuntu ISO package

There are many ways to create bootable USB in Ubuntu. Some are related to the use of system tools, while others depend on the installation of external packages. In this article, we will use the Ubuntu command line terminal to create a bootable Ubuntu USB flash drive. We will do this using the dd command. A terminal is a great alternative to complete your tasks from the Ubuntu user interface. Using the terminal makes certain tasks more efficient and even faster. Command line tools do not consume too many resources and therefore are a good alternative to widespread graphical applications, especially if you do not get along with old equipment.

We ran the commands and procedures mentioned in this article on the Ubuntu 18.04 LTS system.

Please follow these steps in sequence to create a bootable Ubuntu USB through your terminal:

Step 1: Download the Ubuntu 18.04 LTS ISO File

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

Click on any Ubuntu package you want to install. I will click on the link 18.04 LTS under Ubuntu Server. The following dialog box appears:

Select the “Save File” option and click “OK.” The .iso package will be saved in the Downloads folder.

Step 2: Open a Terminal

Open the Ubuntu command line, Terminal, either by searching the Ubuntu Application Launcher or by using the keyboard shortcut Ctrl + Alt + T.

Open Ubuntu Terminal

Step 3: Unmount the USB if it is connected

Before you write your flash drive, make sure that it is not automatically connected to your Ubuntu. Insert USB into your system, and then run the following command to get your USB name:

$ df

Disconnect USB drive

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

Make a note of the device name (/ dev / sdb1 in my case) and the path on which it is mounted (/ media / sana / Ubuntu-Server 18.04.2 LTS amd64 in my case).

There are two ways to disconnect USB from Ubuntu:

1. Using the path to which USB is connected:

$ sudo umount /path/where/mounted

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

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

Unmount media

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

$ sudo umount /device/name

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

$ sudo umount /dev/sdb1

Step 4: Create Ubuntu Bootable USB Flash Drive

Now that you have disconnected USB, you know the name and path of your ISO image, as well as the name of your device, to create a bootable USB, you only need one command. This is the syntax of the dd command, which you can use in your terminal:

$ sudo dd bs = 4M if = / path / to / ISO file = / dev / sdx status = progress oflag = synchronization

Tip: Instead of entering a command, you can copy it from here and paste it into the Terminal using Ctrl + Shift + V, or using the Paste option in the context menu.

I will use the following command to write Ubuntu ISO to my USB:

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

The command will start writing the ISO to your USB and display the status bar as follows:

Burn ISO using the dd command to a USB drive

In a few minutes, your bootable USB drive with the Ubuntu ISO recorded on it will be ready.

So, of the many ways to create a bootable USB, we looked at the Terminal application for this purpose. You must have seen that this does not require the installation of an additional application and takes much less time than some user interface applications. Thanks to this and many others, I recently became a supporter of the preference for the command line over the user interface, even for people who are not very familiar with terminal commands. That is why I am trying to explain the procedure as simple as possible.

How to create a bootable USB flash drive from an Ubuntu terminal