mac command line formatting a disk

Mac Format

diskutil partitionDisk /dev/disk2 1 GPT HFS+ newdisk R

MSDOS Format

diskutil eraseDisk "ms-dos fat32" PRT MBRFormat /dev/disk2