Home  >  Article  >  System Tutorial  >  What does the commonly used Linux command mkdir mean?

What does the commonly used Linux command mkdir mean?

下次还敢
下次还敢Original
2024-04-11 19:12:191200browse

The mkdir command in Linux is used to create directories. Options include: -p (create non-existent parent directory), -v (print creation details), -m (set permission mode), and -Z (set SELinux security context). For example, mkdir Documents creates the "Documents" directory, mkdir -p Projects/Team1/ProjectA creates both the "Projects/Team1" and "ProjectA" directories, and mkdir -m 755 Data creates the "Data" directory with "755" permission mode.

What does the commonly used Linux command mkdir mean?

Introduction to mkdir command

The mkdir (make directory) command is used in Linux to create a new directory (folder ).

Using syntax

<code>mkdir [选项] 目录名</code>

Options

  • -p:simultaneous creation does not exist 's parent directory.
  • -v: Print operation details after successful directory creation.
  • -m:Set the permission mode of the new directory.
  • -Z: Set the SELinux security context.

Example usage

  • Create a directory named "Documents":

    <code>mkdir Documents</code>
  • Create the parent directory "Projects/Team1" and the directory "ProjectA" at the same time:

    <code>mkdir -p Projects/Team1/ProjectA</code>
  • Create the directory "Data" with the "755" permission mode:

    <code>mkdir -m 755 Data</code>
  • Create directory "tmp" with a specific SELinux security context:

    <code>mkdir -Z /tmp</code>

Tip

  • The directory name can be Relative path (starting from the current working directory) or absolute path (starting from the root directory).
  • If you want to create a multi-level directory, please use the -p option.
  • mkdir The command only creates directories and does not automatically create files.

The above is the detailed content of What does the commonly used Linux command mkdir mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn