mkdir 命令说明: 新建目录 语法: mkdir [-mp] 目录名称 参数: -m :配置文件的权限,直接设置,不需要看默认权限(umask) -p :帮助你直接将所需要的目录(包括上层目录)递归创建起来 命令实践: [iyunv@yubinghost ~]# cd /tmp [iyunv@yubinghost tmp]# mkdir test [iyunv@yubinghost tmp]# mkdir -p test1/test2/test3/test4 [iyunv@yubinghost tmp]# umask 查看默认权限umask 0022 [iyunv@yubinghost tmp]# ll total 16 drwx------ 2 root root 4096 Apr 7 11:18 ssh-lEggct3110 drwxr-xr-x 2 root root 4096 Apr 7 12:49 test drwxr-xr-x 3 root root 4096 Apr 7 12:49 test1 -rw-r--r-- 1 root root 0 Apr 5 14:54 test.txt -rw-r--r-- 1 root root 0 Apr 7 11:37 yubing [iyunv@yubinghost tmp]# mkdir -m 744 test2 配置文件的权限 [iyunv@yubinghost tmp]# ll total 20 drwx------ 2 root root 4096 Apr 7 11:18 ssh-lEggct3110 drwxr-xr-x 2 root root 4096 Apr 7 12:49 test drwxr-xr-x 3 root root 4096 Apr 7 12:49 test1 drwxr--r-- 2 root root 4096 Apr 7 12:50 test2 -rw-r--r-- 1 root root 0 Apr 5 14:54 test.txt -rw-r--r-- 1 root root 0 Apr 7 11:37 yubing [iyunv@yubing ~]# mkdir yubing 创建新目录 [iyunv@yubing ~]# ll total 64 -rw------- 1 root root 887 Apr 7 01:47 anaconda-ks.cfg -rw-r--r-- 2 root root 255 Jan 6 2007 crontab1 lrwxrwxrwx 1 root root 12 Apr 8 04:06 crontab2 -> /etc/crontab -rw-r--r-- 1 root root 23947 Apr 7 01:47 install.log -rw-r--r-- 1 root root 3619 Apr 7 01:46 install.log.syslog drwxr-xr-x 2 root root 4096 Apr 12 06:13 yubing [iyunv@yubing ~]# mkdir -p /yu/bing/first 直接将所需要的目录(包括上层目录)递归创建起来 [iyunv@yubing yubing]# cd /yu total 8 [iyunv@yubing yu]# ll drwxr-xr-x 3 root root 4096 Apr 12 06:14 bing [iyunv@yubing yu]# cd bing [iyunv@yubing bing]# ll total 8 drwxr-xr-x 2 root root 4096 Apr 12 06:14 first [iyunv@yubing /]# mkdir -pv /yu/bing/first 加了-v参数,会把详细过程显示出来 mkdir: created directory `/yu' mkdir: created directory `/yu/bing' mkdir: created directory `/yu/bing/first'
|