
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. The syntax is going to look like this: Diskutil eraseDisk JHFS+ Empty /dev/disk5s2

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”. This is the syntax we need: Diskutil eraseDisk FILESYSTEM DISKNAME DISKIDENTIFIER Then pick a name and a system format type. Once you have found the proper drive to erase, just copy its identifier so you can use it for the next command. This is going to list all the mounted drives on your Mac. Start off by running the following command in the command line: Diskutil list This is how you execute commands on your Mac using the command line. Here I'll show you how you can erase and format a disk using the command line. Your Mac comes with an app called Terminal under Applications > Utilities. To do that, the only thing you need is a bit of precise syntax to make sure that you are erasing the proper disk. It works on XP, Vista, Windows 7, Server 2003 and Server 2008 operating systems.
#MAC COMMAND LINE LIST ALL DISKS HOW TO#
Below are few examples on how to use this command. This can be used to get mac address for remote computers also. For example, ctrl+v (paste) ctrl+c (copy), ctrl+z (undo) and ctrl+a (select all) still all work on a Mac, just replacing the control key with the command key. Get mac address from command line (CMD) We can find mac address (physical address) of a computer using the command ‘ getmac ‘. Then a quick ls will list the available drives. Most Windows commands will work in OSX by simply pressing command instead of control. So to get there, type cd /Volumes/ and hit Enter. You can limit the number of disks shown by specifying filtering arguments such as internal above, and/or a device disk. If no argument is given, then all whole disks and their partitions are listed.
#MAC COMMAND LINE LIST ALL DISKS MAC OS X#
But some Mac users might need to erase them from the command line on Mac OS. Mac OS X lists all external drives in the /Volumes/ directory. List disks, including internal and external disks, whole disks and partitions, and various kinds of virtual or offline disks. The command will list all the drives that are available with the computer.


Type the command as mentioned above and press Enter to launch DiskPart. Most users use Disk Utility to erase a disk or hard drive. Search command prompt, right-click, and run it as an administrator.
