When a USB stick has been used for, say, a bootable Linux distribution, it usually cannot be re-used as a mass storage device by, say, Windows. These instructions are to wipe/reset a usb stick so it will work as it used to.
cat /proc/partitions dmesg | tail # you need to be root for that one
The device name should be something like /dev/sdb or /dev/sdc, let's call it /dev/sdx
(1) Wipe the bootsector of the USB stick:
drive=/dev/sdx \dd if=/dev/zero of="$drive" bs=512 count=1
Set the type "FAT32" for that partition.
TODO - fdisk can be automated, turning this whole set of instructions into one script.
(3) Write a FAT32 filesystem on it:
drive=/dev/sdx \mkdosfs -F32 "$drive"1