Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report