Home > System Tutorial > LINUX > body text

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

下次还敢
Release: 2024-04-11 21:18:18
Original
545 people have browsed it

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

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>
Copy after login
  • In Create a folder named "Temp" in the current directory and set permissions to 755:
<code>mkdir -m 755 Temp</code>
Copy after login
  • 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>
Copy after login

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!

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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template