
mmd Command in Linux
The mmd is a command line utility in Linux that is used to create directories for MS-DOS (FAT) filesystems. It is part of the mtools package which is a collection of utilities designed for working with MS-DOS filesystems without needing to mount them.
The mmd command enables us to create directories effortlessly, which makes it an essential tool for managing FAT filesystems on Linux. If a directory already exists, you will encounter an error.
Table of Contents
Here is a comprehensive guide to the options available with the mmd command −
- What is mmd Command in Linux?
- Syntax of mmd Command
- mmd Command Options
- Installation of mmd Command
- Examples of mmd Command in Linux
- Troubleshooting Common Issues with mmd Command
What is mmd Command in Linux?
The mmd command is part of the mtools package, which is used to work with files and folders on MS-DOS filesystems. Unlike regular Linux commands, mtools commands like mmd let you perform tasks directly on an MS-DOS filesystem, such as creating folders, copying files, or deleting data, without mounting the filesystem.
For example, if you have a USB drive with a FAT32 format, you can use mmd to create folders on it without mounting the drive.
Syntax of mmd Command
To use the mmd command in Linux, you type mmd followed by the drive and the name of the directory you want to create. You can also include optional flags to customize its behavior, depending on your requirements −
mmd [options] <msdos-drive>:<directory-path>
Here, <msdos-drive> represents a drive (e.g., a: or c:) while <directory-path> is the directory you want to create.
mmd Command Options
Most of the options are inherited from the mtools package, and mmd itself is mainly used for creating directories. You can use the following options with mmd to enhance its functionality −
- -v (verbose mode): Displays detailed information about the command's execution.
- -D: Specifies debug mode to help identify issues during execution.
- --version: Returns the version of mmd installed on your system.
To learn more about the command and its usage, access the general manual page by executing the following command −
man mmd

Installation of mmd Command
The mmd command is included in the mtools package. You can install it using your Linux distribution's package manager: For example, Debian/Ubuntu users can execute the following command to install mmd on their systmes −
sudo apt update sudo apt install mtools
Similarly, the dnf package manager can be used to install mmd on fedora-based distributions −
sudo dnf install mtools
For Arch-based distributions, the pacman package manager can be used for mmd installation −
sudo pacman -S mtools
After installing the mmd command on your system, you can confirm its availability by running the following command −
mmd --version
The output shows the mmd version, which proves that it is already available on our system −

This confirms that mmd is installed on your system, and you can start using it.
Examples of mmd Command in Linux
Let's go through some practical usage examples of the mmd command to learn how it works in Linux −
Creating a Directory on a Specific Drive
In the following code example, we use the mmd command to create a directory named tutorialspoint on the drive “a:” −
mmd a:/tutorialspoint
Creating a Directory Using a Full Path
We can also specify the complete path of the directory to be created using the mmd command −
mmd a:/project/tutorials2024
If the project directory does not exist, this command will fail since mmd cannot create intermediate directories. In this case, you must create the project directory first.
Debugging Directory Creation
You can specify the -D option with the mmd command to debug the directory creation −
mmd -D a:/debugTutorials
It will troubleshoot issues when the command fails.
Working with Images
If you're working with an MS-DOS filesystem image (like a floppy disk image), you can use the mmd command with the -i option to create directories in it
mmd -i floppy.img ::/docs
Here, the -i option specifies the filesystem image file.
Integration with Scripts
You can integrate the mmd command into shell scripts to automate directory creation tasks on MS-DOS filesystems. For example −
#!/bin/bash # Define the drive and directory name drive="a:" directory="new_folder" # Create the directory using mmd mmd $drive/$directory echo "Directory $directory created on $drive"
In this script, the mmd command is used to create a directory named new_folder on the a: drive. You can run this script to automate the task of creating directories on MS-DOS filesystems.
Troubleshooting Common Issues with mmd Command
While working with mmd, you may encounter issues such as "Drive not found" or "Permission Denied", etc. Here are some solutions to help you resolve these problems −
- If you get a "Drive not found" error, make sure the MS-DOS drive (e.g., a:) is correctly specified and accessible.
- If you encounter a "Permission Denied" issue, check that you have write permissions for the target filesystem or file.
- Remember that mmd doesn't support creating multiple directories at once. You will need to create each directory level one by one.
That's all about the Linux mmd command.
Conclusion
The mmd command is a useful tool for creating directories on MS-DOS (FAT) filesystems directly from Linux without mounting the drive. As part of the mtools package, it simplifies tasks such as folder creation on drives like USBs formatted with FAT32. While it's a straightforward command, you may encounter issues such as missing directories or permission errors, but these can be easily fixed with the troubleshooting tips provided.
With proper installation and usage, mmd becomes an essential tool for managing FAT filesystems on Linux, especially when integrated into scripts for automation. In this article, we explained how to use mmd command in Linux with practical examples.