Insert the USB drive to be formatted.

Check the name of your USB drive by :

#  fdisk   -l

Let the name be “sdb1”.

Unmount the USB drive :

#  umount  /dev/sdb1

Now, to format the USB in ext2 format :

#  mke2fs  /dev/sdb1

For journaling (ext3) support :

#  mke2fs  -j  /dev/sdb1

To create MS-DOS filesystem :

#  mkdosfs  /dev/sdb1

We can also use ‘mkfs’ :

#  mkfs  -t  vfat  -v  /dev/sdb1

[-t] – specifies the type of filesystem needed like ext2, ext3, fat, etc. Default is ext2.
[-v] – produces verbose output.