2.1 系统目录结构(上)
命令ls(list):用来列取这个目录或者文件
/bin、/sbin 、/usr/bin、/usr/sbin 目录:用来存放一些常用命令文件
其中/sbin是存放root用户才能使用的命令,/bin是存放普通用户使用的命令(root用户也能用)
/boot 目录:系统启动相关的文件
/dev : linux下特有的设备文件
/etc: 系统的配置文件
/home: 用户的家目录
/lib、/lib64 : 系统的库文件,类似于window的dll文件
[root@localhost usr]# ldd /bin/ls ##ldd命令,查看一个文件依赖哪些库文件
linux-vdso.so.1 => (0x00007fffaaded000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fa2b33fa000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fa2b31f5000)
libacl.so.1 => /lib64/libacl.so.1 (0x00007fa2b2fec000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa2b2c1f000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fa2b29bd000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fa2b27b9000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa2b3621000)
libattr.so.1 => /lib64/libattr.so.1 (0x00007fa2b25b4000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa2b2398000)
useradd ##添加普通用户
tree 以树状结构显示目录
yum install -y tree ## 安装tree命令
[root@localhost usr]# tree --help
usage: tree [-acdfghilnpqrstuvxACDFQNSUX] [-H baseHREF] [-T title ] [-L level [-R]]
[-P pattern] [-I pattern] [-o filename] [--version] [--help] [--inodes]
[--device] [--noreport] [--nolinks] [--dirsfirst] [--charset charset]
[--filelimit[=]#] [--si] [--timefmt[=]<f>] [<directory list>]
------- Listing options -------
-a All files are listed.
-d List directories only.
-l Follow symbolic links like directories.
-f Print the full path prefix for each file.
-x Stay on current filesystem only.
-L level Descend only level directories deep.
-R Rerun tree when max dir level reached.
-P pattern List only those files that match the pattern given.
-I pattern Do not list files that match the given pattern.
--noreport Turn off file/directory count at end of tree listing.
--charset X Use charset X for terminal/HTML and indentation line output.
--filelimit # Do not descend dirs with more than # files in them.
--timefmt <f> Print and format time according to the format <f>.
-o filename Output to file instead of stdout.
--du Print directory sizes.
--prune Prune empty directories from the output.
-------- File options ---------
-q Print non-printable characters as '?'.
-N Print non-printable characters as is.
-Q Quote filenames with double quotes.
-p Print the protections for each file.
-u Displays file owner or UID number.
-g Displays file group owner or GID number.
-s Print the size in bytes of each file.
-h Print the size in a more human readable way.
--si Like -h, but use in SI units (powers of 1000).
-D Print the date of last modification or (-c) status change.
-F Appends '/', '=', '*', '@', '|' or '>' as per ls -F.
--inodes Print inode number of each file.
--device Print device ID number to which each file belongs.
------- Sorting options -------
-v Sort files alphanumerically by version.
-r Sort files in reverse alphanumeric order.
-t Sort files by last modification time.
-c Sort files by last status change time.
-U Leave files unsorted.
--dirsfirst List directories before files (-U disables).
------- Graphics options ------
-i Don't print indentation lines.
-A Print ANSI lines graphic indentation lines.
-S Print with ASCII graphics indentation lines.
-n Turn colorization off always (-C overrides).
-C Turn colorization on always.
------- XML/HTML options -------
-X Prints out an XML representation of the tree.
-H baseHREF Prints out HTML format with baseHREF as top directory.
-T string Replace the default HTML title and H1 header with string.
--nolinks Turn off hyperlinks in HTML output.
---- Miscellaneous options ----
--version Print version and exit.
--help Print usage and this help message and exit.
[root@localhost usr]#
[root@localhost usr]# tree -L 2 / ##指定显示/目录下的2级目录及文件
man --用来显示一个文件的帮助文档
2.2 系统目录结构(下)
centos7下已经没有32位和64位的区分了,全部是64位了,
32位和64位系统的区别在于识别的内存不一样 ,32位系统只能识别到3点多G的内存!当你内存大于4G时,最好安装64位系统
/media: 这是一个媒介目录,默认是空的
/mnt : 这也是一个临时挂载目录,默认为空
/proc : 这个目录下存放着一些系统启动的进程
/run 进程产生的临时文件,重启或关机就消失的
/srv service的缩写,存放一些服务产生的文件
/tmp 系统的临时目录
/var/log/messages 系统的日志文件
2.3 ls命令
ls -l 可以把文件的详细信息列出来
[root@localhost ~]# ls -l
总用量 4
-rw-------. 1 root root 1117 7月 22 13:59 anaconda-ks.cfg
ls -i 查看文件的inode信息
[root@localhost ~]# ls -i
202832448 anaconda-ks.cfg
ls -lh 以人性化显示文件的大小
[root@localhost ~]# ls -lh
总用量 4.0K
-rw-------. 1 root root 1.1K 7月 22 13:59 anaconda-ks.cfg
[root@localhost ~]#
ls -a 显示隐藏文件(文件名前面带一个.的就是隐藏文件)
[root@localhost ~]# ls -a
. .. anaconda-ks.cfg .bash_history .bash_logout .bash_profile .bashrc .cshrc .pki .ssh .tcshrc .viminfo
ls -t 按文件的时间顺序排列。越近的排上面
[root@localhost ~]# ls -lat
总用量 52
-rw-------. 1 root root 8715 7月 26 23:17 .bash_history
drwx------. 2 root root 24 7月 24 19:35 .ssh
dr-xr-x---. 4 root root 4096 7月 24 19:35 .
dr-xr-xr-x. 17 root root 4096 7月 24 00:36 ..
-rw-------. 1 root root 6787 7月 22 19:07 .viminfo
drwxr-----. 3 root root 18 7月 22 15:28 .pki
-rw-------. 1 root root 1117 7月 22 13:59 anaconda-ks.cfg
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
[root@localhost ~]#
ls -d 只列出目录本身而不会列出目录下面的文件
[root@localhost ~]# ls -ld /
dr-xr-xr-x. 17 root root 4096 7月 24 00:36 /
[root@localhost ~]#
ll 和ls -l是一样的效果,实际是就是ls -l 的一个别名
[root@localhost ~]# ll
总用量 4
-rw-------. 1 root root 1117 7月 22 13:59 anaconda-ks.cfg
[root@localhost ~]#
2.4 文件类型
常见的文件类型
1.普通文件 : 即一般类型的文件,当用ls -l查看一个目录时,第一个属性为"-"的文件就是普通文件,分为纯文本文件和二进制文件,普通文件可以通过cat查看文件内容,而二进制文件不能
2.目录: 与window下的文件夹类似,当用ls -l 查看目录时,第一个属性显示为"d"的就是目录了
3.链接文件 :当用ls -l 查看目录时,第一个属性显示为"l"的就是链接文件,相当于windows的快捷方式
2.5 alias命令
which:查找文件的命令(可以用来查看一个命令的别名)
[root@localhost ~]# which ls
alias ls='ls --color=auto'
/usr/bin/ls
[root@localhost ~]#
alias: 查看系统中都有哪些命令是用的别名
[root@localhost ~]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@localhost ~]#
通过alias命令来自定义一个命令:
[root@localhost ~]# alias xzl='ls -lhta'
[root@localhost ~]# xzl
总用量 52K
-rw-------. 1 root root 8.6K 7月 26 23:17 .bash_history
drwx------. 2 root root 24 7月 24 19:35 .ssh
dr-xr-x---. 4 root root 4.0K 7月 24 19:35 .
dr-xr-xr-x. 17 root root 4.0K 7月 24 00:36 ..
-rw-------. 1 root root 6.7K 7月 22 19:07 .viminfo
drwxr-----. 3 root root 18 7月 22 15:28 .pki
-rw-------. 1 root root 1.1K 7月 22 13:59 anaconda-ks.cfg
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
[root@localhost ~]# which xzl
alias xzl='ls -lhta'
/usr/bin/ls
[root@localhost ~]#
上面我们自定义了一个命令“xzl” 使运行xzl命令时实际上是运行了“ls -lhta”这条命令
如果要取消一个别名,则只需要用到以下命令:
[root@localhost ~]# unalias xzl
2.6 相对路径和绝对路径
绝对路径:路径的写法一定是由根目录/写起的,例如:/etc/selinux/config
相对路径:路径的写法不是由根目录/写起的。而是相对当前目录。
2.7 cd 命令
命令cd是用来变更用户所在目录的
pwd: 显示当前所在目录
[root@localhost ~]# pwd
/root
[root@localhost ~]#
cd - : 进入到上一次所在目录
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@localhost network-scripts]# cd -
/root
[root@localhost ~]# cd -
/etc/sysconfig/network-scripts
[root@localhost network-scripts]#
cd .. :进入到当前目录的上一级目录
[root@localhost sysconfig]# pwd
/etc/sysconfig
[root@localhost sysconfig]# cd ..
[root@localhost etc]# pwd
/etc
[root@localhost etc]#
2.8 创建和删除目录mkdir rmdir
mkdir:(make directory的简写)用于创建目录,该命令的格式为:mkdir [-mp] [目录名称],
其中-m选项用于指定要创建目录的权限,这个不常用。
-p选项可以帮我们创建一大串级联目录:
[root@localhost etc]# mkdir /tmp/test/123
mkdir: 无法创建目录"/tmp/test/123": 没有那个文件或目录
[root@localhost etc]# mkdir -p /tmp/test/123
[root@localhost etc]# ls /tmp/test
123
[root@localhost etc]#
rmdir: (remove directory的简写)用于删除空目录,该命令只能删除目录,不能删除文件,rmdir和mkdir具有相同的选项-p ,它同样可以级联删除一个串空目录。
2.9 rm命令
rm是最常用的删除文件和目录的命令,它有两个常用的选项:
-r:删除目录用的选项,类似于rmdir ,但可以删除非空目录。
[root@localhost etc]# rm -r /tmp/test/123
rm:是否删除目录 "/tmp/test/123"?y ##这里会询问是否需要删除,输入y确定,n否定
[root@localhost etc]# ls /tmp/test/123
ls: 无法访问/tmp/test/123: 没有那个文件或目录
[root@localhost etc]#
-f: 表示强制删除。它不再询问是否删除,而是直接删除。
通常使用最多的是-rf组合命令,这样删除文件或目录比较方便,但是一定要注意rm -rf 后面不能加“/”否则它会把你的系统文件全部删除,系统就GG了
2.10 环境变量PATH
为什么我们使用命令时,只是直接打出了命令,而没有使用这个命令的绝对路径呢?
这就是环境变量PATH在起作用。
[root@localhost etc]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
只要命令的目录在这个PATH变量中,那么你执行的命令就都可以生效,反之,如果你把一个命令的目录从变量中删除了,那这个命令就无效了
在环境变量中新增一个命令路径的方法:
[root@localhost etc]# PATH=$PATH:/root/tmp
[root@localhost etc]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/tmp
2.11 cp命令
cp是copy的简写,该命令的格式为:cp [选项] [来源文件] [目的文件], 常用选项:
-r 复制目录
[root@localhost /]# mkdir 123
[root@localhost /]# cp 123 456
cp: 略过目录"123"
[root@localhost /]# cp -r 123 456
[root@localhost /]# ls -ld 123 456
drwxr-xr-x. 2 root root 6 7月 27 18:20 123
drwxr-xr-x. 2 root root 6 7月 27 18:21 456
2.12 mv命令
mv是move的简写,就是移动文件或目录的意思,该命令的格式为:mv [选项] [源文件或目录] [目标文件或目录]
该命令有以下几种情况:
1.目标文件是目录,但该目录不存在.
2.目标文件是目录,且该目录存在.
3.目标文件是文件,且该文件不存在.
4.目标文件是文件,但该文件存在.
当目标文件是目录时,其存在与否,执行后的结果是不一样的.如果该目录存在,则会把源文件或目录移动到该目录中.如果该目录不存在,则会把源目录重命名为给定的目标文件名.
2.13 文档查看cat_more_less_head_tail
cat:用于查看文件的内容,常用的选项:
-n : 查看文件时,把行号也显示到屏幕上,
[root@localhost ~]# cat -n /etc/passwd
1 root:x:0:0:root:/root:/bin/bash
2 bin:x:1:1:bin:/bin:/sbin/nologin
3 daemon:x:2:2:daemon:/sbin:/sbin/nologin
4 adm:x:3:4:adm:/var/adm:/sbin/nologin
5 lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
6 sync:x:5:0:sync:/sbin:/bin/sync
7 shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
8 halt:x:7:0:halt:/sbin:/sbin/halt
9 mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
10 operator:x:11:0:operator:/root:/sbin/nologin
11 games:x:12:100:games:/usr/games:/sbin/nologin
12 ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
13 nobody:x:99:99:Nobody:/:/sbin/nologin
14 avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
15 systemd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin
16 systemd-network:x:998:996:systemd Network Management:/:/sbin/nologin
17 dbus:x:81:81:System message bus:/:/sbin/nologin
18 polkitd:x:997:995:User for polkitd:/:/sbin/nologin
19 tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
20 postfix:x:89:89::/var/spool/postfix:/sbin/nologin
21 sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
[root@localhost ~]#
-A:显示所有的内容,包括特殊字符.
[root@localhost ~]# cat -A /etc/passwd
root:x:0:0:root:/root:/bin/bash$
bin:x:1:1:bin:/bin:/sbin/nologin$
daemon:x:2:2:daemon:/sbin:/sbin/nologin$
adm:x:3:4:adm:/var/adm:/sbin/nologin$
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin$
sync:x:5:0:sync:/sbin:/bin/sync$
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown$
halt:x:7:0:halt:/sbin:/sbin/halt$
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin$
operator:x:11:0:operator:/root:/sbin/nologin$
games:x:12:100:games:/usr/games:/sbin/nologin$
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin$
nobody:x:99:99:Nobody:/:/sbin/nologin$
avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin$
systemd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin$
systemd-network:x:998:996:systemd Network Management:/:/sbin/nologin$
dbus:x:81:81:System message bus:/:/sbin/nologin$
polkitd:x:997:995:User for polkitd:/:/sbin/nologin$
tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin$
postfix:x:89:89::/var/spool/postfix:/sbin/nologin$
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin$
tac:和cat一样,只不过是以倒序的顺序显示文件里的内容
[root@localhost ~]# tac /etc/passwd
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
polkitd:x:997:995:User for polkitd:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
systemd-network:x:998:996:systemd Network Management:/:/sbin/nologin
systemd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin
avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
halt:x:7:0:halt:/sbin:/sbin/halt
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
sync:x:5:0:sync:/sbin:/bin/sync
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
bin:x:1:1:bin:/bin:/sbin/nologin
root:x:0:0:root:/root:/bin/bash
[root@localhost ~]#
more:当文件内容太多,一屏不能全部显示时,用命令cat肯定是看不了前面的内容,这是可以用more,当看完一屏后,按空格键可以继续看下一屏,看完所有内容后就会退出
less:比more功能要多一些,按空格键可以翻页,按JK键可以上下移动.
head:用于显示文件的前10行,如果加-n选项,则显示文件的前几行.
tail: 和head相反的用法,显示文件的后10行.
2.14 文件或目录权限chmod
每个Linux文件具有四种访问权限:可读(r)、可写(w)、可执行(x)和无权限(-)。
利用ls -l命令可以看到某个文件或目录的权限,它以显示数据的第一个字段为
准。第一个字段由10个字符组成,如下:
-rwxr-xr-x
第一位表示文件类型,-表示文件,d表示目录
2-4位表示文件所有者的权限,u权限
5-7位表示文件所有者所属组成员的权限,g权限
8-10位表示所有者所属组之外的用户的权限,o权限
2-10位的权限总和有时称为a权限
chmod
该命令有两种用法。一种是包含字母和操作符表达式的文字设定法;另一种是包含数字的数字设定法。chmod 是用来改变文件或目录权限的命令,但只有文件的属主和超级权限用户root才有这种权限。
我们前面已经说了,文件或目录的权限位总共有9个位置 ,文件属主、文件所归属的组占用三位和其它用户各占用三个位置。看个例子:
-rwxr-xr-x 1 root root 0 04-23 20:11 linuxsir007.txt
说明:
1. chmod 的八进制语法的数字说明;
r 4 w 2 x 1 - 0
属主的权限用数字表达:属主的那三个权限位的数字加起来的总和。比如上面的例子中属主的权限是rwx ,也就是4+2+1 ,应该是7;
属组的权限用数字表达:属组的那个权限位数字的相加的总和。比如上面的例子中的r-x ,也就是4+0+1 ,应该是5;
其它用户的权限数字表达:其它用户权限位的数字相加的总和。比如上面例子中是 r-x ,也就是4+0+1 ,应该是5;
例如:改变一个文件的权限
但是对于一个文件夹
1.如果想改变文件夹本身的权限而不改变其子文件的权限,不加任何参数
查看文件夹以及文件夹下全部子文件
2. 改变自身和子文件夹权限
3.不改变自身权限,只改变子文件夹权限
[root@localhost ~]# chmod -R 644 bin/.[a-z]*
上面的例子chmod 会匹配所有以.a到.z 开头的文件。
2 通过 chmod 助记语法来改变文件或目录的权限
chmod 的助记语法相对简单,对文件或目录权限的改变时,是通过比较直观的字符的形式来完成;在助记语法中,相关字母的定义;
用户或用户组定义:
u 代表属主
g 代表属组
o 代表其它用户
a 代表属主、属组和其它用户,也就是上面三个用户(或组)的所有;
权限定义字母: r 代表读权限; w 代表写权限; x 代表执行权限;
权限增减字符;
- 代表减去相关权限; + 代表增加相关权限;
[root@localhost ~]# chmod ugo-x 123.txt 注:把属主、用户组及其它用户的执行权限都减掉
[root@localhost ~]# chmod u+x 123.txt 注:为文件的属主增加执行权限
[root@localhost ~]# chmod u-x,go+rw 123.txt 注:减去文件属主对文件的执行权,增加属组和其它用户对文件的可读可写权
用助记语法比较灵活,组合起来比较方便;比如;
u=r+x 为文件属主添加读写权限;
ug=rwx,o=r 为属主和属组添加读、写、执行权限,为其它用户设置读权限。
a+x 为文件的属主、属组和其它用户添加执行权限;
g=u 让文件的属组和属主和权限相同;
对于目录权限的设置,要用到-R参数;
和八进制方法一样,如果我们为一个目录及其下的子目录和文件具有相同的属性,就可以用-R参数;
[root@localhost ~]# chmod -R a+rwx testdir/
2.15 更改所有者和所属组chown
chown 命令可以更文件的所有者,其格式为:chown [-R] 账户名 文件名或者chown [-R] 账户名:组名 文件名 . 这里的-R选项只适用于目录,作用是级联更改
[root@localhost ~]# mkdir dir3
[root@localhost ~]# useradd user1 ##创建用户user1
[root@localhost ~]# touch dir3/test3 ##在dir3目录下创建test3文件
[root@localhost ~]# chown user1 dir3
[root@localhost ~]# ls -ld dir3 ##dir3目录所有者已经由root改为user1
drwxr-xr-x. 2 user1 root 18 7月 28 11:41 dir3
[root@localhost ~]#
2.16 umask
默认情况下,目录的权限值为755,普通文件的权限值为644 ,这个值就是由umask规定的.
查看umask的值:
[root@localhost ~]# umask
0022
用umask设置默认权限时,文件和目录是不一样的:
对于文件而言,用户创建时,默认是没有可执行(x)权限的,只有r、w两项权限,所以其最大默认权限值是666,即为:-rw-rw-rw-。
对于目录而言,用户创建时,由于x权限关系到用户能否进入此目录,所以默认是开放全部权限的,,所以其最大默认权限值是777,即为;-rwxrwxrwx
比如:
最大权限值: 777 rwxrwxrwx 666 rw-rw-rw-
umask值: 021 ----w---x 021 ----w---x
实际的权限值:756 rwxr-xrw- 646 rw-r--rw-
在实际中可能会遇到这种情况:umask值包含奇数(例如:003),但实际新创建出来的文件(不是目录)的权限值里并没有包含奇数(会是:664)。这是因为文件的最大默认值是666,若umask值中包含x权限(即:会有奇数出现)时,系统在创建新文件时会自动过滤掉x权限。
这里针对这种情况提供两种计算新建文件权限值的方法:
(1)数值计算:
当umask中全部是偶数时,可以直接减,当umask中包含奇数时,对于目录直接减,对于文件,在奇数所在的位减完后加一即可。
(2)符号方式:
就是umask中设置了哪些权限,在实际中就把这些权限拿走不要就行了,剩下的权限就是实际新建文件的权限。