Home> System Tutorial> LINUX> body text

What is the command mkdir in linux?

下次还敢
Release: 2024-04-11 19:18:20
Original
938 people have browsed it

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:

mkdir [选项] [目录名称]
Copy after login

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:

mkdir [选项] 目录名称
Copy after login

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

mkdir Documents
Copy after login

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

mkdir -p Documents/Work
Copy after login

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

mkdir -m 755 Documents
Copy after login

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!

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 Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!