Home >System Tutorial >LINUX >What is the command mkdir in linux?

What is the command mkdir in linux?

下次还敢
下次还敢Original
2024-04-11 19:18:201218browse

The mkdir command in Linux is used to create directories. The syntax is: mkdir [options] [directory name]. Options include: -p (create non-existent parent directory), -m (set directory permission mode), -v (display details). Usage examples: mkdir Documents can create a directory named "Documents"; mkdir -p Documents/Work can create a "Documents/Work" subdirectory; mkdir -m 755 Documents can set the permission mode of the "Documents" directory to 755.

What is the command mkdir in linux?

The mkdir command in Linux

The mkdir command is used to create a new directory (file folder). It is a powerful tool that allows you to organize and manage files easily.

Syntax:

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

Options:

  • -p: Create does not exist 's parent directory.
  • -m mode: Set the permission mode of the directory.
  • -v: Display the details of the creation process.

How to use the mkdir command:

To create a new directory, use the following syntax:

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

For example, to create a To create a new directory named "Documents", use the following command:

<code>mkdir Documents</code>

To create a multi-level directory using the mkdir command, use the -p option. For example, to create a subdirectory named "Documents/Work", you would use the following command:

<code>mkdir -p Documents/Work</code>

To set the permission mode of the new directory, use the -m option. For example, to set the permission mode of the "Documents" directory to 755, you would use the following command:

<code>mkdir -m 755 Documents</code>

Other useful examples:

  • Create a temporary directory : mkdir /tmp/tmp-dir
  • Create a directory with a parent directory: mkdir -p /path/to/new-dir
  • Create a directory with a specific permission mode: mkdir -m 775 /path/to/secure-dir

The above is the detailed content of What is the command mkdir in linux?. 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