The -m option in the mkdir command allows you to set the permissions for the new directory at the time of its creation. You specify the permissions in numeric (octal) format.
Syntax:
mkdir -m permissions directory_name
Example:
To create a directory named new_folder with permissions set to 755 (read, write, and execute for the owner; read and execute for the group and others), you would use:
mkdir -m 755 new_folder
Explanation of Permissions:
7(owner): Read (4) + Write (2) + Execute (1) = 75(group): Read (4) + Execute (1) = 55(others): Read (4) + Execute (1) = 5
This command creates new_folder with the specified permissions immediately upon creation. If you have more questions or need further clarification, feel free to ask!
