Home > System Tutorial > LINUX > body text

What does the commonly used Linux command mkdir mean?

下次还敢
Release: 2024-04-11 19:12:19
Original
1206 people have browsed it

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>
Copy after login

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>
    Copy after login
  • Create the parent directory "Projects/Team1" and the directory "ProjectA" at the same time:

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

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

    <code>mkdir -Z /tmp</code>
    Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template