Skip to content

Consider taking a moment to explain mkdir -p #1485

@dmolesUC

Description

@dmolesUC

How could the content be improved?

We say

Note that mkdir is not limited to creating single directories one at a time. The -p option allows mkdir to create a directory with nested subdirectories in a single operation:

$ mkdir -p ../project/data ../project/results

but:

  1. we haven't actually used the word "nested" up to this point
  2. as a student, it wouldn't occur to me that just mkdir ../project/data wouldn't work
  3. from the example, it's hard to tell:
    1. that we're creating nested structures (the ../ makes it less obvious)
    2. that -p isn't necessary just to create two directories with one command

It might be clearer if we did something like:

mkdir project1 project2      # shows creating two directories
mkdir project1/data/final    # doesn't work
mkdir -p project1/data/final # shows how -p works
mkdir -p project3/data/final # shows that -p creates multiple levels

Which part of the content does your suggestion apply to?

https://swcarpentry.github.io/shell-novice/instructor/03-create.html#creating-directories

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions