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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.