linux系统下who&who am i与whoami的区别,以及与select * from dba_users的区别

who am i :表示登录此虚拟机(或者计算机)时,使用的操作系统级别用户名称

whoami:表示当前正在使用的操作系统级别用户名称

select username from dba_users;查询的是当前数据库中所拥有的用户名称(属于数据库级别);


[root@rhel58 oracle]# who

oracle   :0           2015-01-04 23:47
oracle   pts/0        2015-01-04 23:48 (:0.0)

oracle   pts/1        2015-01-05 09:36 (192.168.0.111)


[root@rhel58 oracle]# who am i

oracle   pts/0        2015-01-04 23:48 (:0.0)


[root@rhel58 oracle]# whoami

root


[root@rhel58 oracle]# su - oracle
[oracle@rhel58 ~]$ who
oracle   :0           2015-01-04 23:47
oracle   pts/0        2015-01-04 23:48 (:0.0)

oracle   pts/1        2015-01-05 09:36 (192.168.0.111)


[oracle@rhel58 ~]$ who am i

oracle   pts/0        2015-01-04 23:48 (:0.0)


[oracle@rhel58 ~]$ whoami
oracle


原文地址:https://www.cnblogs.com/yldf/p/11900192.html