You might want to create a bootable USB stick from Ubuntu itself for various reasons. Some of these include:
- Installing/upgrading Ubuntu
- Having the experience of the Ubuntu desktop without involving your system configurations
- Using the USB stick to fix a configuration issue through the default tools that come 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 the installation of external packages. In this article, we will be using the Ubuntu command line, the Terminal, in order to create a bootable Ubuntu USB stick. We will be doing so by using the dd command. The Terminal is a great alternative to performing your tasks through the Ubuntu UI. Using the Terminal makes certain tasks more efficient and, even faster. The command-line tools do not use too many resources and thus form great alternatives to the widely used graphical applications, especially if you are stuck up with older hardware.
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.
Please follow these steps, one-by-one, in order 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 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 while, your bootable USB will be ready with the Ubuntu ISO written on it.
So, out of the many options available to create a bootable USB, we explored using the Terminal application for this purpose. You must have seen that it did not require the installation of any added application and took a lot lesser time than how much some UI applications do. Through this example, and many more, I have lately become an advocate of preferring the command line over the UI, even for people who are not very fluent with Terminal commands. For this very reason, I try explaining the procedure in as simple a manner as possible.