how to format USB Flash Disk using Ubuntu terminal [duplicate]

I'm a total newbie in Linux specially Ubuntu, I'm just asking on how to format a USB using Ubuntu terminal. Hope you can help me thanks!


Solution 1:

  • First, you have to find out which device (/dev/sd??) your USB stick is. Therefore look at the output of

    sudo fdisk -l
    
  • After that unmount the device/partition (if necessary) by running

    sudo umount /dev/sd??
    

    Make sure you replaced ?? with the correct device/partition name from the previous output.

  • To format The partition as FAT32 use

    sudo mkdosfs -F 32 -I /dev/sd??
    

    Again replace ?? with your respective letters.

Be careful that if you enter the wrong device name, you might also accidentally format your hard disk!

You can also do

    sudo -s

and you don't have to put "sudo" in front of everything!