You may want to create a bootable USB stick of Ubuntu yourself for various reasons. Some of these reasons are:
- Install/Upgrade Ubuntu
- Have the experience of the Ubuntu desktop without involving your system configurations
- Using the USB stick to fix a configuration issue with the standard tools provided with the Ubuntu ISO package
There are many ways to create a bootable USB in Ubuntu. Some involve using the system tools, while others depend on installing external packages. In this article, we will use the Ubuntu command line, the terminal, to create a bootable Ubuntu USB flash drive. We will do this with the dd command. The Terminal is a great alternative for performing your tasks from 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 and therefore are a good alternative to the widespread graphical applications, especially if you don’t get along with older hardware.
We have run the commands and procedures mentioned in this article on an Ubuntu 18.04 LTS system.
Please follow these steps in sequence to create a bootable Ubuntu USB via 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:
Click on any Ubuntu package you want to install. I will click on the 18.04 LTS link under Ubuntu Server. This will open the following dialog:
Select the Save File option and then click OK. The .iso package will be saved to your Downloads folder.
Step 2: Open the Terminal
Open your Ubuntu command line, the Terminal, either through the Ubuntu Application Launcher search or by using the Ctrl+Alt+T shortcut.
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 to your system and then run the following command in order to fetch your USB’s name:
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 18.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 18.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 in 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:
$ 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 on your USB and display a status bar as follows:
After a few minutes, your bootable USB with the Ubuntu ISO written on it will be ready.
So, of the many ways to create a bootable USB, we have looked at the Terminal application for this purpose. You must have seen that it does not require the installation of an additional application and takes much less time than some UI applications do. Through this example and many others, I have recently become an advocate of preferring the command line over the UI, even for people who are not very familiar with terminal commands. This is exactly why I try to explain the procedure as simple as possible.