linux format usb command line

C++
df -h 
Select the correct drive
sudo umount /dev/sdc1
This command formats the drive as FAT32, you can use other formats too
sudo mkfs.vfat /dev/sdc1umount
fdisk -l to get the dev/sxxx
For the vFAT (FAT32) file system: sudo mkfs.vfat /dev/sdc1
Source

Also in C++: