Home  >  Article  >  System Tutorial  >  What command is used to create a directory in linux?

What command is used to create a directory in linux?

下次还敢
下次还敢Original
2024-04-11 21:45:20978browse

The command to create a directory in Linux system is mkdir, its syntax is as follows: mkdir [option] directory name, the options include: -p creates a non-existent parent directory; -v displays the created directory; -m settings Directory permissions. For example, create a directory named mydir: mkdir mydir; create a directory named securedir with 755 permissions: mkdir -m 755 securedir; create a directory named nesteddir under a non-existent parent directory: mkdir -p /path/ to/nesteddir.

What command is used to create a directory in linux?

Command to create directory in Linux

In Linux operating system, the command to create directory is mkdir.

Syntax

##mkdir [options] Directory name

Options

  • -p: Create a non-existent parent directory.
  • -v: Display the created directory.
  • -m: Set the permissions of the directory.

Example

Create a directory named mydir

<code>mkdir mydir</code>

Create a directory named securedir with 755 permissions

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

Create a directory named nesteddir under a non-existent parent directory

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

Tip

    Directory names can contain letters, numbers, underscores, and hyphens.
  • cannot start with a dot or slash.
  • Do not use reserved words such as
  • con, prn or aux.
  • To create multi-level directories, you can use nested
  • mkdir commands, or use the -p option.

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