For students and new users learning how to use Linux systems, the easiet place to start might be on Ubuntu Linux OS… Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…
The same way you use your mouse and keyboard to move files / folders and perform others tasks on Microsoft Windows OS, Ubuntu also makes it that easy… Just like how easy Windows 7 and 10 are, Ubuntu desktop is also that intuitive and great for beginners…
However, when you’re learning to use and understand Ubuntu Linux, you’ll also want to learn the comnands behind the graphics and mouse-clicking… and how to use them… This tutorial is going to show you how…..
This post shows new users and students what the mkdir command is used for and how to use it…
When you’re ready to learn how to use the mkdir commands, follow the guide below:
About mkdir command:
The mkdir command on Ubuntu allow user create new directories if they do not already exist on the file systems… Like using your mouse and keyboard to create new folders… the mkdir is the way to do it on the command line…
The syntax is the rule and format of how the mkdir command can be used… the systax can options can be reordered.. but straight format must be followed.,.
Below is an example syntax of how to use the mkdir comamnd….
mkdir [OPTION]... DIRECTORY...
The command line options are switches or flags that determined how the commands are executed or controlled… they modify the behavior of the command… they are separated by spaces and followed after the commands options…
Below are some options of the mkdir command:
|DIRECTORY…||Replace DIRECTORY ….. with the name of the directory you want to create…. If the specified directory does not already exist, mkdir creates it…..|
|Use the -m or –mode option set file mode (as in chmod), not a=rwx – umask. The syntax of MODE is the same as with the chmod command.|
|Use the -p or –parents option to make parent directories as needed|
|Verbose output. Print a message for each created directory.|
|-Z||Use the -Z option to set SELinux security context of each created directory
to the default type
|–help||Use the –help option with the command to display this help and exit|
|–version||Use the –version option to output version information and exit|
Below are some examples of how to run and use the mkdir on Ubuntu Linux…
Run the command below create a new directory called Confidential without any mkdir command options… This will just createa a simple directory or folder called Confidential…..
You can use the mkdir command with the -m or –mode option to create a directory and specify the permissions as well… For example, to createa a directory or folder called Confidential and set a permission, run the commands below….
mkdir -m a=rwx Confidential
The above command will create a Confidential directory and give all users = read , write, and execute permissions…. (a = read, write, execute)
When you run mkdir with the –help option, you’ll see the help text below:
Usage: mkdir [OPTION]... DIRECTORY... Create the DIRECTORY(ies), if they do not already exist. Mandatory arguments to long options are mandatory for short options too. -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask -p, --parents no error if existing, make parent directories as needed -v, --verbose print a message for each created directory -Z set SELinux security context of each created directory to the default type --context[=CTX] like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX --help display this help and exit --version output version information and exit
Hope you like it and please come back soon for more Ubuntu Linux command!
You may also like the commands below: