Creating New Directories

Use the mkdir (make directory) command to create new directories, such as the following:

mkdir acme reports/acme

This example creates an acme directory within the current directory; it also creates one in the reports subdirectory of the current directory.

You can use the mkdir -p option to create a new directory and automatically create any missing parent directories, as in the following command:

mkdir -p /cities/Europe/UnitedKingdom/England/London

In this example, if the UnitedKingdom directory did not exist, it would be created. Then England would be created as a subdirectory, and London would be created as a subdirectory of England.

mkdir allows multiple pathnames, as noted in Table 3.4.

Table 3.4. One Other Property ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.