Format Flash Drive Mac Terminal

Format

Let’s take an example - the drive you want to format has “/dev/disk5s2” as its identifier and the file system, in this case, is FAT32 and you named the drive as “Full”. So, the command you will run in the terminal becomes - Diskutil eraseDisk FAT32 FULL /dev/disk5s2. Connect the flash drive that you want to format. Go to Applications and Utilities and launch Disk Utility. The application will appear on the screen, and you will see the main window, with a list of available storage devices on the left and various disk management options on the right. Label the NTFS drive you want to use with a one-word name. Launch a Terminal open by pressing Command and the Space Bar at the same time. Type “Terminal” and hit the enter key. You can also open Terminal by going into Applications, then to Utilities, and finally, Terminal. Once you are in Terminal, type the following line of code.

Format Flash Drive Mac Fat32

Most users use Disk Utility to erase a disk or hard drive. But some Mac users might need to erase them from the command line on Mac OS. To do that, the only thing you need is a bit of precise syntax to make sure that you are erasing the proper disk.

Here I'll show you how you can erase and format a disk using the command line.

Working with Terminal

Start off by running the following command in the command line: Diskutil list

This is going to list all the mounted drives on your Mac.

Format Pen Drive Mac Using Terminal

Once you have found the proper drive to erase, just copy its identifier so you can use it for the next command. Then pick a name and a system format type. This is the syntax we need: Diskutil eraseDisk FILESYSTEM DISKNAME DISKIDENTIFIER

TerminalDrive

Format Flash Drive Mac Fat32 Terminal

Let’s say the disk I want to erase has “/dev/disk5s2” as its identifier and I’m going to use Mac OS Extended Journaled (JHFS+) as the system format type and name it “Empty”. The syntax is going to look like this: Diskutil eraseDisk JHFS+ Empty /dev/disk5s2

Format Flash Drive Mac Terminal File

Access flash drive on mac

It’s important to keep in mind that if you run the eraseDisk command, the target disk is going to lose all its data, so make sure you are erasing the proper disk.

If you need different system format types, here are a few references you could use instead of JHFS+:

Format Flash Drive Windows 10

  • Mac OS Extended: HFS+
  • MS-DOS fat32: FAT32
  • ExFAT: ExFAT