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. 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. The format command is a Command Prompt command used to format a specified partition on a hard drive (internal or external), floppy disk, or flash drive to a specified file system. You can also format drives without using a command. To format your USB drive on Mac, enter the following command: sudo diskutil eraseDisk FORMAT VOLUME-NAME USB-LOCATION-AND-NAME Where: FORMAT is where you choose which format you want to use when erasing and formatting your pen drive. There are many file types available when you format a USB drive on Mac, such as exFAT, FAT32, JHFS+, etc.

  1. Mac Flash Drive Format
  2. Mac Command Line
  3. Format Flash Drive Mac Command Line Download
  4. Format Flash Drive Mac Fat32

These days, CDs and DVDs are becoming more and more obsolete every day. Being able to write a Linux distro ISO to a USB drive is usually both faster and better than using a Linux CD or DVD. While there are many Graphical User Interface (GUI) tools to write an ISO to a flash drive, this article will discuss how to write an ISO file to a USB flash drive by command line in Linux.

Maybe it is because people prefer to use GUI’s, and some are scared of using the command line, but, interestingly, writing an ISO to a USB flash drive is extremely easy once you understand the commands.

This article is a tutorial, and I will give you step-by-step information about how to write an ISO file to a USB flash drive by command line.

Step 1: Insert Your USB Drive And Find Out Where The USB Drive Is Put By The OS

First, insert your USB drive. And, next, we need to find out exactly exactly where the USB drive is placed by the OS. Do this command to find out where the flash drive is place:
sudo fdisk -l
Once you do the aforementioned command you should get output like:

Since I know that my USB drive is 16GB in size, the one I am looking for is the last /dev/sdb1.

Step 2: Unmount Our USB Flash Drive

Next, before we do anything more, we should unmount our USB flash drive for peace of mind to make sure there are no data loss problems, but don’t remove it from your computer. Since my drive is located at /dev/sdb1 I will do:

Flash

sudo umount /dev/sdb1

Step 3: Download the Linux ISO And Then CD Into That Directory

I downloaded the latest version of Linux Mint 32 bit edition and am using it in this example. We need to go into the folder into wherever your iso file is. I am going to assume my file is located at ~/Downloads/

Do:
cd ~/Downloads/

Step 4: Actually Write The ISO To Your USB Drive

Here is the command that will ultimately write the ISO to your USB drive (Don’t actually do it yet, because I need to explain a few things to make sure you do it correctly)

#sudo dd if=linuxmint-18.1-mate-32bit.iso of=/dev/sdb

While this command may seem cryptic, actually, it is easy to understand. dd is a command we can use to write an iso to a usb flash drive in Linux by command line. Nearly every modern Linux distro should have dd installed by default.

Mac Flash Drive Format

From the manual for dd, here are the various options we use in the dd command:

Flash

if=FILE means read from FILE instead of stdin
of=FILE mean write to FILE instead of stdout

So in our case for the command:
#sudo dd if=linuxmint-18.1-mate-32bit.iso of=/dev/sdb
linuxmint-18.1-mate-32bit.iso is the file we are reading from (i.e. the iso file we are reading from), and of is where we are writing to, which in our case is /dev/sdb

Mac Command Line

And as a side note, we need to write to the entire device, /dev/sdb/ instead of /dev/sdb1. As Qubes describes, “Make sure to write to the entire device (e.g., /dev/sda) rather than just a single partition (e.g., /dev/sda1).” So, even though when I did sudo fdisk -l, and found out that my usb drive is located at /dev/sdb1, I still need to use the dd command at /dev/sdb1

OK. Now that you have that background information, we will actually do the command to write the ISO file to your USB flash drive. (make sure to remove the # in the following command once you are ready. I put the # there to prevent accidental problems if you didn’t intend to do the command or didn’t understand the command.)

#sudo dd if=linuxmint-18.1-mate-32bit.iso of=/dev/sdb

After this, the program will “hang” for a little bit. Maybe it will take more than 2 minutes. But eventually, you will see some output such as:

And then you will see a command prompt when the computer has finished writing the ISO to the USB flash drive. Those things tell you that the ISO was successfully written to your USB flash drive.

Format Flash Drive Mac Command Line

Final Steps And Comments

Lastly, turn off your computer. Now your USB flash drive should have a Linux distro on it and you can install your new Linux distro from your USB drive. ☺

You may need to configure your motherboard to have USB drives boot first before your hard drive.

Format Flash Drive Mac Command Line Download

There shouldn’t be a need to format your USB drive before writing the ISO to your flash drive(if you are just writing a Linux ISO) before all of these steps in the tutorial it since dd will write over everything on the USB drive. But, just to be safe, you can format it to NTFS or FAT32 with gparted if you want.

Format Flash Drive Mac Fat32

What did you think of this article? Did you learn anything interesting? Do you have anything to add? Let’s discuss it in the comments below.