Home>Article>Operation and Maintenance> Check the currently logged in username in linux

Check the currently logged in username in linux

王林
王林 Original
2020-02-15 14:20:55 6269browse

Check the currently logged in username in linux

Method 1: Execute the command whoami

[root@test01 ~]# whoami

The results are as follows:

root

Online learning video sharing:linux video tutorial

Method 2: Execute the command lastlog

[root@test01 ~]# lastlog

The results are as follows:

Username Port From Latest root pts/0 10.0.0.1 Fri Aug 31 09:11:19 +0800 2018 bin **Never logged in** daemon **Never logged in** adm **Never logged in** lp **Never logged in** sync **Never logged in** shutdown **Never logged in** halt **Never logged in** mail **Never logged in** operator **Never logged in** games **Never logged in** ftp **Never logged in**

Recommended related articles and tutorials:linux tutorial

The above is the detailed content of Check the currently logged in username in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn