Home  >  Article  >  System Tutorial  >  What is the command to create a new folder in Linux?

What is the command to create a new folder in Linux?

下次还敢
下次还敢Original
2024-04-11 21:24:20702browse

Linux The command to create a folder is mkdir, and the syntax is mkdir [option] folder name. Options include: -p recursively creates the parent directory; -v displays the creation process; -m sets permissions; -Z sets the SELinux context. Usage example: mkdir example or mkdir -p /path/to/example.

What is the command to create a new folder in Linux?

Linux command to create a new folder

In the Linux system, the command to create a folder is mkdir(make directory).

Syntax:

<code>mkdir [选项] 文件夹名</code>

Options:

  • -p (parents): Recursively create a parent directory that does not exist.
  • -v (verbose): Display the process of creating a folder.
  • -m(mode): Set the permissions of the folder.
  • -Z: Set up the SELinux context.

Using:

To create a new folder, enter the following command in the terminal:

<code>mkdir 文件夹名</code>

For example, to create Folder named "example", please run:

<code>mkdir example</code>

If you want to recursively create a parent directory that does not exist, please use the -p option:

<code>mkdir -p /path/to/example</code>

Other notes:

  • If the folder already exists, the mkdir command will not perform any operation.
  • The folder name can contain spaces, but must be enclosed in quotation marks.
  • You must have permission to create folders.

The above is the detailed content of What is the command to create a new folder 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