Erasing And Formatting A Disk From Terminal In macOS

In the Terminal App type diskutil list to show all of mounted drives and determin the appropriate drive to erase.

To erase and format a disk with macOS Extended Journaled (JHFS+) is as follows.

diskutil eraseDisk JHFS+ New_Name_Of_Disk /dev/disk0

Lists of file formats
– APFS – apfs
– Mac OS Extended Journaled – JHFS+
– Mac OS Extended – HFS+
– MS-DOS fat32 – FAT32
– MS-DOS ExFAT – ExFAT