Skip to content

Consider changing the way we introduce mkdir -p #1521

@nbraunsc

Description

@nbraunsc

How could the content be improved?

During my teaching demo, I found that when we introduce the mkdir -p concept it was confusing (and the instructor also agreed). I also saw there was another issue raised about this section in April.

When 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

It is pretty confusing for the following reasons:

  1. We are combining two different concepts that may be overlooked. We are using the -p command (without explaining what it actually stands for) and we are creating two directories at the same time. The main idea about how -p allows you to create directories in a different location might be overlooked.
  2. We never cd into the /project directory first to show what the current folders/files are, therefore it is not super straight forward that it actually created them.
  3. We also never end up using these directories.

A few suggestions could be something like we first cd ../projects and then ls to show the contents. Then we cd ../ and pwd to show that we are in /Users/nelle/Desktop/shell-lesson-data/exercise-data/. Then introduce the path idea (without the ../) so it would be mkdir -p /projects/data. Followed by ls -FR project/.

Then if you wanted to show that you can make multiple directories at the same time (although, I don't think this is super important), then you could run mkdir -p projects/results projects/conclusions.

I personally almost never use the -p command but if we do want to teach it, then I think some reorganizing about this concept would be beneficial to the learners. Thanks!

Which part of the content does your suggestion apply to?

https://github.com/swcarpentry/shell-novice/blob/main/episodes/03-create.md

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