MOTD ⚙ CHAPTERS 01 / 05
TODAY'S QUIZ0 / 5 STREAK0 days POINTS0 THE OPERATOROpen

$man 1 mkdir

Ten things the page says. Every one of them is on your machine right now — run the command above and check.

  1. 01

    Create the DIRECTORY(ies), if they do not already exist.[man]

  2. 02
    -m, --mode=MODE

    set file mode (as in chmod), not a=rwx - umask.[man]

  3. 03
    -p, --parents

    no error if existing, make parent directories as needed, with their file modes unaffected by any -m option.[man]

  4. 04
    -Z

    set SELinux security context of each created directory to the default type.[man]

  5. 05
    --context[=CTX]

    like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX.[man]

  6. 06

    Mandatory arguments to long options are mandatory for short options too.[man]

  7. 07

    mkdir creates directories with the specified names.[info]

  8. 08

    mkdir creates each directory NAME in the order given.[info]

  9. 09

    It reports an error if NAME already exists, unless the -p option is given and NAME is a directory.[info]

  10. 10

    '-m MODE' --mode=MODE Set the file permission bits of created directories to MODE, which uses the same syntax as in 'chmod' and uses 'a=rwx' (read, write and execute allowed for everyone) for the point of the departure. .[info]

$run --yourself

Build a whole tree in one call

-p is what makes mkdir safe to run twice, which is what makes it usable inside a script.

These commands write files, so run them in a scratch directory:

$ mkdir -p ~/motd-lab && cd ~/motd-lab
~/motd-lab
$ mkdir -p project/src/lib
$ mkdir -p project/src/lib
$ mkdir -v -m 700 private
$ ls -ld private
$ find project -type d

WHAT YOU SHOULD SEEThe second mkdir -p succeeds silently instead of erroring. private is created as drwx------. find lists all four directories.

$quiz -n 5

Five questions, each one taking a term out of a line above. Ten points for each. Tap hear it to have a question read to you; answering plays the verdict.

QUESTION 1 OF 5

Which term completes this line from the page? “Create the _____(ies), if they do not already exist.”

From point 1 above.

QUESTION 2 OF 5

Which term completes this line from the page? “no error if existing, make parent _____ as needed, with their file modes unaffected by any -m option.”

From point 3 above.

QUESTION 3 OF 5

Which term completes this line from the page? “like -Z, or if CTX is specified then set the SELinux or _____ security context to CTX.”

From point 5 above.

QUESTION 4 OF 5

Which term completes this line from the page? “mkdir _____ directories with the specified names.”

From point 7 above.

QUESTION 5 OF 5

Which term completes this line from the page? “It _____ an error if NAME already exists, unless the -p option is given and NAME is a directory.”

From point 9 above.

Answer all five to bank your points.

$play --chapters 5

Five chapters, three voices. Tap one to jump — the player at the bottom of the screen follows.

download the full edition

$tee --everyone

Know someone with ten minutes and a terminal? Send them today's page. This is the card that appears when you post it:

Share card for mkdir(1): make directories
2026-10-13 · 1200×630

$su - operator

The Operator has a dispatch on mkdir(1), and he files them for subscribers only. It is free. Join the club, or read about the series.

MOTD is a weekday reading of one manual page already installed on your own machine. Every statement is quoted from that page or from the GNU info documentation beside it, and every edition names the command that shows you the source.

archive · the operator · about · podcast · Feline Union

NARRATION · 3 VOICES · 01
Last login