Home>Article>Operation and Maintenance> 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!