- 论坛徽章:
- 0
|
你知道你你的LOGNAME是如何来的吗? .
你知道你的LOGNAME是如何来的吗?我之所以这样问,也是因为刚刚才发现这其间的小秘密。
我们都知道id -u显示的是你当前的uid号码,但是加上那个-n就不同了,下面我们来看看他们的区别:- [root@SYS ~]# id
- uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
- [root@SYS ~]# id -u
- 0
- [root@SYS ~]# id-un【-n显示名字而不是id号】
- root
- [root@SYS ~]#
复制代码 也就是说LOGNAME就是通过id -un来显示的。
Ps:
id小节
=========================================================================- id - print user identity
- -a ignore, for compatibility with other versions
- -r, --real
- print the real ID instead of the effective ID, with -ugG
- -Z, --context
- print only the security context of the current process
- [root@SOR_SYS ~]# id -a
- uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
- [root@SOR_SYS ~]# id -u
- 0
- [root@SOR_SYS ~]# id -g
- 0
- [root@SOR_SYS ~]# id -G
- 0 1 2 3 4 6 10
- [root@SYS ~]# id -n【发现了吧,这个-n必须得和其他参数,比如说-u,-g,-G联合使用。】
- id: cannot print only names or real IDs in default format
- [root@SYS ~]# id -un
- root
- [root@SYS ~]# id -gn
- root
- [root@SYS ~]# id -Gn
- root bin daemon sys adm disk wheel
复制代码 【输出的结果就是所属的组以及附加组】 |
|