mkdir

Make a directory.

Format

   mkdir [option] directory-list

Summary

The mkdir utility creates one or more directories.

Arguments

The directory-list contains one or more pathnames of directories that mkdir creates.

Options

-p parent If the parent directory of the directory you are creating does not already exist, it will be created by mkdir if you use the -p option.

Notes

You must have permission to write to and to search (execute permission) the parent directory of the directory you are creating. The mkdir utility creates directories that contain the standard invisible entries . and (representing the directory itself) and .. (representing the parent directory).

Examples

The following command creates a directory named accounts as a subdirectory of the working directory, and a directory named prospective as a subdirectory of accounts.

z123456@turing:~$ mkdir -p accounts/prospective

Below, without changing working directories, the same user creates another subdirectory within the accounts directory.

z123456@turing:~$ mkdir accounts/existing

Finally, the user changes the working directory to the accounts directory and creates one more subdirectory.

z123456@turing:~$ cd accounts
z123456@turing:~/accounts$ mkdir closed