From time-to-time you will need to give format to an usb drive in your Linux system, for example to backup important files or just share data with a colleague. In this recipe I will show you the commands you could use in Debian/Ubuntu.
First start plugging the USB and then check where the system recognise it, for that use:
It will show you at the end of the report, in that locate the lines that says "usb" and "New USB device found", below those oyu will find messages from other modules/drivers that says "sd" and between square brakts you will find the device name like "[sdb]" and below yu will find fro example "sdb: sdb1", sbd1 is the name you are looking for.
Make sure is not mounted you can check it with:
you can dismount with:
sudo umount /dev/sdb1 # for this example
the tool we are going to use is mkfs, if is not installed in your system, you can execute
sudo apt install dosfstools
now you are ready to go, for the format execute:
sudo mkfs.vfat -c -n <drive_label> /dev/sdb1 or sudo mkfs -t vfat -c -n <drive_label> /dev/sdb1
Checking the drive after the format is done:
sudo dosfsck -vV /dev/sdb1
done! you have a new USB that you can use in windows and also in linux.