RHEL6 ls输出中新的句号/周期是什么意思?


16

我们有一些脚本正在ls -l查看权限信息的输出,这些脚本最近在RHEL v6系统上失败.了,在权限条目的末尾似乎显示了一个以前没有的额外内容:

[root@rhel6vm ~]# ls -l
total 44
-rw-------. 1 root root  1399 Aug 17 15:01 anaconda-ks.cfg
-rw-r--r--. 1 root root 25485 Aug 17 15:01 install.log
-rw-r--r--. 1 root root  7253 Aug 17 14:59 install.log.syslog
[root@rhel6vm ~]#
          ^
          | up there

句号表示什么?还有什么地方可以出现?


1
We have scripts looking at the output of ls,那通常是个坏主意。解析ls是个坏主意。为此,您最好查看stat或其他工具的输出。
Zoredache

Answers:


19

信息ls显示:

  Following the file mode bits is a single character that specifies
 whether an alternate access method such as an access control list
 applies to the file.  When the character following the file mode
 bits is a space, there is no alternate access method.  When it is
 a printing character, then there is such a method.

 GNU `ls' uses a `.' character to indicate a file with an SELinux
 security context, but no other alternate access method.

 A file with any other combination of alternate access methods is
 marked with a `+' character.

啊哈-看过man ls' but didn't think of 信息
ls'-

8

GNU ls使用一个.字符来指示具有SELinux安全上下文的文件,但没有其他替代访问方法。

具有其他替代访问方法组合的文件将用+字符标记。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.