How to create directories and subdirectories in Linux with the 'mkdir' command

In case of unavailability, it would be impossible for anyone to modify, add or delete files stored on their computer. Being really annoying for some.

For this it is characterized by being a manageable system through the command window, since avoid information being manipulated by guests.

Creating directories within a folder is also done via a command, known as " mkdir " acronym for make subdirectory.

Learning how to implement this command inside the command box is very simple, as it is also extremely objective with respect to its function. So you just have to read on to find out a little more or learn how to hide files and folders in Linux.




Use the mkdir command to create directories on Linux

The "Create subdirectory" command has a fairly simple syntax. Well, just place the order, followed by the name of the directory you want to give the folder to create it.

However, as mentioned above, as a GNU / Linux administrator the user must ensure that they have the permissions within the folders in which will modify the content.

Otherwise, after completing writing the command, an error message will appear and it will be impossible to create the desired folder.

How to create directories and subdirectories in Linux with the 'mkdir' command

To use the command correctly, perform the procedure discussed above: place the acronym, followed by the argument you will use to name the directories that will be created.

An example of this could be " mkdir folder1 “, Then the new content will be created inside the folder you are currently working in. In case you want it to be created inside a location, just specify it as follows: " mkdir / folders / folder1 “, Where“ Folders ”is the library where you want to locate the content.




Other useful commands

While the "mkdir" command is running to create directories within system memory, other commands can improve folder performance. They can help you in case you need to perform a specific action, like searching for files, for example.

  • To start you can use " pwd “, Which will allow you to discover the folder that is still active, that is, with which you are working at that precise moment.
  • If you don't want to stay in that folder, you can change and select another active folder through "cd".
  • Il "ls" command shows the contents of a folder and verifies its existence
  • Finally, and perhaps one of the most important, the use of ” chmod “ allows you to change permissions within a folder.

Create directories and subdirectories via mkdir

To add subfolders when entering a command, the syntax varies. In addition to indicating the names of the new files, it must be indicated that a root directory will be created which will have the task of containing the rest.

The command determined for this is " -p o -parents “, Which, as mentioned before, will generate a root folder whenever it is needed.


One of the great advantages of this code is that when you use it, you won't get any errors if the folder exists. Therefore, it will only be necessary to write the following in the command window: " mkdir -p / home / user / movies / christine ".


How to create directories and subdirectories in Linux with the 'mkdir' command

According to the syntax defined above, “Home” is set as the root directory and the rest of the name will be the number of subfolders you will create at one time.


It demonstrates the great utility that the “Create Subdirectory” command can provide whenever you need to create directories and subdirectories within the folders that make up your storage space. If it happens that the folder is hidden, you can make them appear from the terminal.

Thanks to its simple syntax, any user who get root permissions within a space on the computer will be able to generate this type of content via the Linux command window.

TagsLinux
add a comment of How to create directories and subdirectories in Linux with the 'mkdir' command
Comment sent successfully! We will review it in the next few hours.