Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the who command of linux to print the currently logged in user

Shulou Source: shulou.com Published: 2022-06-02 18:06:58 09月22日 Update

Editor to share with you the use of linux who command to print the current login users, I hope you will learn a lot after reading this article, let's discuss it together!

Who command is used to print the current login user information, including the system startup time, active process, user ID, user terminal and other information. It is a common command for system administrators to understand the running status of the system.

The output of the who command comes from the files "/ var/log/utmp" and "/ var/log/wtmp" by default.

Syntax format: who [parameters] [options]

Common parameters:

-a print comprehensive information-b print system last startup time-d print dead process-l print system login process-H print user name with column header, login terminal and login time-t print system last lock time-u print list of logged-in users

Reference example

Print user login information (- H prints with column headings):

[root@linuxcool] # who-H

Name line time remarks

Root pts/0 2019-04-10 12:31 (192.168.12.34)

Print all the information:

[root@linuxcool] # who-H-a

Name line time idle process number remark exit

System Boot 2019-04-03 15:01

Runlevel 3 2019-04-03 15:02

Log in to tty1 2019-04-03 15:02 852 id=tty1

2019-04-03 15:31 1022 id=102

Terminal = 0 exit = 0

Root + pts/0 2019-04-10 12:27. 2789 (192.168.12.34)

The last startup time of the printing system:

[root@linuxcool] # who-b

System Boot 2019-04-03 15:01

Print the system login process:

[root@linuxcool ~] # who-l

Log in to tty1 2019-04-03 15:02 852 id=tty1 to finish reading this article, I believe you have a certain understanding of using linux's who command to print current logged-in users, want to know more about it, welcome to follow the industry information channel, thank you for reading!

Tags: Login system time user information command process terminal parameter name remarks common use title article line run user finished instance file Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Redmi Linux Docker Shulou Tech Info