Home  >  Article  >  System Tutorial  >  What are the common commands to create a new folder in Linux?

What are the common commands to create a new folder in Linux?

下次还敢
下次还敢Original
2024-04-11 21:18:18464browse

Use the mkdir command to create a new folder in Linux. The syntax is: mkdir [option] folder name. Options include: -p to create a parent directory, -v to display details, and -m to set permissions. Examples: mkdir Documents, mkdir -m 755 Temp, mkdir -p Downloads/Projects. Related commands: rmdir deletes empty folders, rm -r deletes folders and their contents, mv moves or renames folders.

What are the common commands to create a new folder in Linux?

Common commands for creating new folders in Linux

Common commands for creating new folders in the command line terminal It's mkdir.

Syntax:

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

Options:

  • -p: If the parent directory If it doesn't exist, create it first.
  • -v: Display the detailed process of execution.
  • -m: Set file mode or permissions.

Example:

  • Create a folder named "Documents":
<code>mkdir Documents</code>
  • In Create a folder named "Temp" in the current directory and set permissions to 755:
<code>mkdir -m 755 Temp</code>
  • Create a folder named "Projects" in the "Downloads" directory and specify the superior Create a directory if it does not exist:
<code>mkdir -p Downloads/Projects</code>

Related commands:

  • rmdir: Delete empty folders.
  • rm -r: Delete the folder and all its contents.
  • mv: Move or rename the folder.

The above is the detailed content of What are the common commands 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