create sub directory in linux code example

Example 1: linux mkdir multiple levels

# The -p option tells mkdir to create parent directories as needed
mkdir -p bin docs/personal docs/business lib

Example 2: linux create directory

$sudo mkdir -m777 newFileName

777 is the permissions given to the file
For more info:( https://www.pluralsight.com/blog/it-ops/linux-file-permissions )

Example 3: make directory in linux

mkdir [option] dir_name

Example 4: bash how to create directories in all subdirectories

# Example usage:
for dir in */; do mkdir -- "$dir"/{dir1,dir2,dir3}; done
# This creates directories dir1, dir2, and dir3 in all directories 
# found in the current directory.

Tags:

Misc Example