This question already has an answer here:

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!

marked as duplicate by Byte Commander, Pilot6, Ron, Rinzwind, Eric Carvalho Aug 18 '15 at 13:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • It is not that easy for a niewbie. Why do not use GUI tools? – Pilot6 Aug 18 '15 at 13:14
  • 1
    If you make a mistake, you can format your HDD. There will be no warning. – Pilot6 Aug 18 '15 at 13:24
  • This question is NOT a duplicate (at least not the one marked). That one asks for a GUI, and this one for a command line solution... – Calimo Aug 19 '15 at 10:06
  • @Calimo The other question has been broadened to include command-line solution, just the wording was never removed. – Seth Aug 20 '15 at 1:33
  • 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!

  • 1
    Hi, after doing this I get a: Error while copying to XXXXX The destination is read-only. any clue? – vabada Sep 9 '16 at 6:17
  • sudo chmod 777 /dev/sd?? – madzohan Mar 25 '17 at 16:54
  • Have a SCRIPT for the whole shebang would be nice (with some sanity checks, that it's a a) USB b) removable device c) no larger than 32 GB d) unrelated to the usual pack like /, /boot, etc. as an extra precaution) – Frank Nocke Sep 16 '17 at 12:27
  • If you want to name the volume while formatting, add -n YOUR-NAME to the mkdosfs command. – Zoltán Sep 14 '18 at 14:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.