The difference between who command, whoami command and who am i command

Reprinted from   https://blog.csdn.net/mahao1107/article/details/46851375

Let's take a look at the difference between these commands:

First of all, the Fire login is the root user. Let's take a look at the difference between these three commands:

write picture description here

Then Fire uses the su command to switch to the normal user, and look at the difference between these three commands:

write picture description here

Summarized as follows:

whoami;显示的是当前用户下的用户名
who am i:显示的是登录时的用户名
who:显示当前真正登录系统中的用户(不会显示那些用su命令切换用户的登录者)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324701162&siteId=291194637