Check the currently logged in username in linux

王林
Release: 2020-02-15 14:20:55
Original
6360 people have browsed it

Check the currently logged in username in linux

Method 1: Execute the command whoami

[root@test01 ~]# whoami
Copy after login

The results are as follows:

root
Copy after login

Online learning video sharing: linux video tutorial

Method 2: Execute the command lastlog

[root@test01 ~]# lastlog
Copy after login

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**
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template