Name

mkdir

Synopsis

    mkdir [options]directories

Create one or more directories. You must have write permission in the parent directory in order to create a directory. See also rmdir.

Common Options

-m, --modemode

Set the access mode for new directories.

-p, --parents

Create intervening parent directories if they don’t exist.

GNU/Linux Options

-v, --verbose

Print directory names as they are created.

-Zcontext, --contextcontext

Set the security context. SELinux only.

Mac OS X Option

-v

Print directory names as they are created.

Examples

Create a read/execute-only directory named personal :

    mkdir -m 555 personal

The following sequence:

    mkdir work; cd work
    mkdir junk; cd junk
    mkdir questions; cd ../..

could be accomplished by typing this:

    mkdir -p work/junk/questions

Get Unix in a Nutshell, 4th Edition 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.