How to create a new directory in Linux system?

In Linux systems, you can use the mkdir command to create a new directory. Here's how to create a new directory:

  1. 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 the mkdir command. For example, to create a new directory named "new_directory", you can execute the following command:

    mkdir new_directory
  2. Create a multi-level directory:
    To create a multi-level directory, you can add after the mkdir command -poption. 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
  3. Specify the permissions of the directory:
    By default, the permissions of the new directory created by the mkdir 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 the chmod command to modify the directory permissions.
  4. 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
  5. 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.

Guess you like

Origin blog.csdn.net/tiansyun/article/details/135014314