In Linux systems, you can use the mkdir
command to create a new directory. Here's how to create a new directory:
-
Create a directory under the current directory:
To create a new directory under the current directory, just use in the terminal Just add the name of the new directory to themkdir
command. For example, to create a new directory named "new_directory", you can execute the following command:mkdir new_directory
-
Create a multi-level directory:
To create a multi-level directory, you can add after themkdir
command-p
option. For example, to create a multi-level directory named "parent/child/grandchild" in the current directory, you can execute the following command:mkdir -p parent/child/grandchild
- Specify the permissions of the directory:
By default, the permissions of the new directory created by themkdir
command are 755. That is, the owner has read, write, and execute permissions, and other users have read and execute permissions. If you want to specify different permissions, you can use thechmod
command to modify the directory permissions. -
Create absolute path directory:
To create a directory elsewhere on the system, you can use an absolute path. For example, to create a new directory named "documents" under the/home/user
directory, you can execute the following command:mkdir /home/user/documents
-
Show detailed information when creating a directory:
To display detailed information when creating a directory, you can use-v
Options. For example, to create a new directory named "test" in the current directory and display detailed information, you can execute the following command:mkdir -v test
The above is how to create a new directory in a Linux system. The mkdir
command is a simple and commonly used command that can help you quickly create directories to organize and manage files and data. Hope the above answers are helpful to you! If you have additional questions, please feel free to continue asking.