mkdir: Create directory, common parameter-p. Specific information is as follows:
[[Email protected] ~]# man mkdirformatting page, please wait ... MKDIR (1) User Commands mkdir (1) name mkdir - make directoriessynopsis mkdir [option]... directory ... Description create the directory (ies), if they do not already exist. Mandatory arguments to long options are mandatory for short Options too. -m, --mode=mode set file mode (As in chmod), not a=rwx - umask -p, --parents no error if existing, make parent directories as needed -v, --verbose print a message for each created directory -z, --context=ctx set the SELinux security context of each created directory to &nBsp; ctx --help display this help and exit --version output version information and exit
Parameter explanation:
1,-P: No parent directory when the parent directory is created, there is no error in the parent directory.
[[email protected] ~]# ls -lrt | grep "^d" Drwxr-xr-x. 2 root root 4096 mar 28 07:32 datadrwxr-xr-x 2 root root 4096 Apr 4 18:43 hellodrwxr-xr-x 2 root root 4096 apr 4 18:44 world[[email protected] ~]# mkdir just/ test/ mkdir: cannot create directory ' just/test/': No such file or directory[[email protected] ~]# mkdir -p just/test/ [[ email protected] ~]# ls -lrt | grep "^d" drwxr-xr-x. 2 root root 4096 mar 28 07:32 datadrwxr-xr-x 2 root root 4096 Apr 4 18:43 hellodrwxr-xr-x 2 root root 4096 apr 4 18:44 worlddrwxr-xr-x 3 root root 4096 apr 4 18:52 just[[email protected] ~]# ls -lrt just/test/total 0
2.-M: Sets the file mode when the directory is created.
[[email protected] ~]# mkdir hello[[email protected] ~]# ls-ld hello/drwxr-xr-x 2 root root 4096 Apr 4 18:56 Hello/[[ema Il protected] ~]# mkdir-m 644 world[[email protected] ~]# ls-ld world/drw-r--r--2 root root 4096 Apr 4 18:57 world/
User default Create Directory permission is 755, can be specified by-m to create directory permissions.
3,-V: Prints each created directory information.
[[email protected] ~]# mkdir-v hellomkdir:created directory ' Hello ' [[email protected] ~]# ls-ld hello/drwxr-xr-x 2 root Root 4096 Apr 4 18:43 hello/[[email protected] ~]# mkdir world[[email protected] ~]# ls-ld world/drwxr-xr-x 2 root root 4096 APR 4 18:44 world/
4 、--Help: Print and exit.
[[Email protected] ~]# mkdir --helpusage: mkdir [option]... directory ... Create the directory (ies), if they do not already exist. mandatory arguments to long options are mandatory for short options too. -m, --mode=mode set file mode (as in  CHMOD), not a=rwx - umask -p, --parents no error if existing, make parent directories as needed -v, --verbose print a message for each Created directory -z, --context=ctx set the selinux security context of each created directory to ctx --help display this help and exit --version output version information and exitreport mkdir bugs to [email Protected]gnu coreutils home page: 5 、--version: Print the command release information and exit.
[Email protected] ~]# mkdir--versionmkdir (GNU coreutils) 8.4Copyright (C) free software Foundation, Inc.license GP lv3+: GNU GPL version 3 or later
The actual work of the commonly used-p parameters, proficiency in the-p parameter can be.
This article is from the "Yau Xin Zhai" blog, please be sure to keep this source http://mofei.blog.51cto.com/6840705/1760052
mkdir Command Summary