🧹 Format USB drive from macOS command line

If you are ever needing to format a USB thumbdrive on macOS from the command line, this will get you going. The first command will show you the drives so you can figure out which one is the USB. You will want to swap out DRIVENAME for what you want to name the USB drive.

diskutil list
diskutil unmountDisk /dev/disk2
diskutil eraseDisk FAT32 DRIVENAME /dev/disk2