To install Ubuntu 16.04.3 on my laptop, I used my 8GB pen-drive. The installation of OS has done now. I want to clean this bootable pen-drive to use it normally.I want to clean it completely like we do in GUI.
3 Answers
The easiest way is with dd
but you must be careful to specify the device exactly:
dd if=/dev/zero of=/dev/sdX count=1 bs=512
This will erase the partition table / MBR (Master Boot Record) making the pendrive empty and ready for reformatting.
Replace sdX
with sdc
, sde
, etc. matching your pendrive letter revealed by lsblk
.

- 102,282
Format your pen-drive using 'Disks' utility in Ubuntu, then you can use it normally. Here is the link for the same : How to format a USB flash drive?

- 26
- 4
An easy and safe method is to restore the USB pendrive to a standard storage device with mkusb
. It will wipe the current partition table and create an MSDOS partition table and a partition with a FAT32 file system.
See the following links,
help.ubuntu.com/community/mkusb
help.ubuntu.com/community/mkusb/wipe
There are more details at this link,

- 46,324
- 5
- 88
- 152