What other `mkdir` options exist?

QuestionsQuestions8 SkillsProDec, 17 2025
0103

Great question! It's always good to explore the full capabilities of commands.

Besides -p (parents), some of the other common and useful mkdir options are:

  1. -m or --mode=MODE: This option allows you to set the file permissions (mode) for the newly created directory.

    • Example: mkdir -m 755 new_directory would create new_directory with read, write, and execute permissions for the owner, and read and execute permissions for others. If you don't specify -m, permissions are usually determined by your system's umask setting.
  2. -v or --verbose: This option prints a message for each directory created. It's helpful if you want confirmation of what mkdir is doing, especially when creating multiple directories or using -p.

    • Example: mkdir -pv a/b/c would show output like:
      mkdir: created directory 'a'
      mkdir: created directory 'a/b'
      mkdir: created directory 'a/b/c'

So, you could combine them too! For instance, mkdir -pv -m 700 project_archive/old_data would create the project_archive and old_data directories, set their permissions to 700, and tell you that it did so.

The mkdir command is quite straightforward, so these are its primary additional options you'll typically encounter.

Do any of these options spark further questions for you?

0 Comments

no data
Be the first to share your comment!