Linux is used to create a directory with the specified name. The user who creates a directory must have the writable permission of the current directory. Otherwise, the user has no permission to create a directory, and the specified directory cannot be an existing directory.

The command format

Mkdir [options] directory

Command function

Create a directory in the specified directory by using mkdir

The command parameter

  • -m,–mode= mode, set permission < mode >(similar to chmod), as inmkdir -m 755 test
  • -p,–parents, if some directories in the path do not exist, the system automatically creates those directories. That is, multiple directories can be created at a time.
  • -v, –verbose Displays information each time a new directory is created
  • –help displays this help information and exits
  • –version Displays the version information and exits

Create a directory

> mkdir test
> ls 
test
Copy the code

Create multiple directories at once

> mkdir -p rumenz/one
Copy the code

Create permission is755Directory of permissions

> mkdir 755 www
Copy the code

Displays information when creating a new directory

> mkdir -v rumenz
Copy the code

A command creates a directory structure for the project

> mkdir -vp src/{lib/,bin/,sbin/{doc,info},doc/{js,css,html},rumenz/lib/{test,info}} mkdir: Create directory 'SRC' mkdir: created directory 'SRC /lib/' mkdir: created directory 'SRC /bin/' mkdir: created directory 'SRC /bin/' Created directory 'SRC /sbin' mkdir: created directory 'SRC /sbin/doc' mkdir: created directory 'SRC /sbin/info' mkdir: created directory 'SRC /sbin/info' mkdir: created directory 'SRC /sbin/info' mkdir: created directory 'SRC /sbin/info' Created directory 'SRC /doc/js' mkdir: created directory' SRC /doc/ CSS 'mkdir: created directory' SRC /doc/ CSS 'mkdir: created directory' SRC /doc/ CSS 'mkdir: created directory' SRC /doc/ CSS 'mkdir: created directory' SRC /doc/ CSS ' Created directory 'SRC /doc/ HTML' mkdir: created directory 'SRC /rumenz' mkdir: created directory 'SRC /rumenz/lib' Created the directory 'SRC/rumenz/lib/test' mkdir: Create directory 'SRC /rumenz/lib/info' > tree SRC SRC SRC ├─ bin ├─ doc │ ├─ CSS │ ├─ HTML │ ├─ js ├─ lib ├─ rumenz │ └ ─ ─ lib │ ├ ─ ─ the info │ └ ─ ─ the test └ ─ ─ sbin ├ ─ ─ doc └ ─ ─ the infoCopy the code

The original:Rumenz.com/rumenbiji/l…