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:
-
-mor--mode=MODE: This option allows you to set the file permissions (mode) for the newly created directory.- Example:
mkdir -m 755 new_directorywould createnew_directorywith 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.
- Example:
-
-vor--verbose: This option prints a message for each directory created. It's helpful if you want confirmation of whatmkdiris doing, especially when creating multiple directories or using-p.- Example:
mkdir -pv a/b/cwould show output like:mkdir: created directory 'a' mkdir: created directory 'a/b' mkdir: created directory 'a/b/c'
- Example:
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?