你知道你你的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【输出的结果就是所属的组以及附加组】

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值