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

How to use the common command who in Linux

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to use Linux common command who, has a certain reference value, interested friends can refer to, I hope you read this article after a lot of gains, the following let Xiaobian take you to understand.

Linux common command who command is used to display which users in the system is above, the information displayed includes user ID, terminal used, from which connection, online time, idle time, CPU usage, action and so on.

syntax who - [husfV] [user]

Parameter Description:

-H or-heading: Displays the header information column for each field;-i or-u or-idle: Displays the idle time. If the user has made any action in the previous minute, it will be marked as ". "number, if the user has not acted for more than 24 hours, then mark the"old"string;-m: this parameter has the same effect as the specified"am i"string;-q or-count: only shows the account name and total number of people logged in to the system;-s: this parameter will be ignored, only responsible for solving compatibility problems with other versions of the who command;-w or-T or-mesg or-message or-writable: displays the user's information status bar;-help: online help;-version: displays version information. examples

Show users currently logged in to the system

# who //shows the user root currently logged in to the system tty7 2014-05-13 12:12 (:0)root pts/0 2014-05-14 17:09 (:0.0)root pts/1 2014-05-14 18:51 (192.168.1.17)root pts/2 2014-05-14 19:48 (192.168.1.17)

Show title bar

# who -HNAME LINE TIME COMMENTroot tty7 2014-05-13 12:12 (:0)root pts/0 2014-05-14 17:09 (:0.0)root pts/1 2014-05-14 18:51 (192.168.1.17)root pts/2 2014-05-14 19:48 (192.168.1.17)

Show user login source

# who -l -HNAME LINE TIME IDLE PID COMMENTLOGIN tty4 2014-05-13 12:11 852 id=4LOGIN tty5 2014-05-13 12:11 855 id=5LOGIN tty2 2014-05-13 12:11 862 id=2LOGIN tty3 2014-05-13 12:11 864 id=3LOGIN tty6 2014-05-13 12:11 867 id=6LOGIN tty1 2014-05-13 12:11 1021 id=1

Display terminal properties

# who -T -HNAME LINE TIME COMMENTroot + tty7 2014-05-13 12:12 (:0)root + pts/0 2014-05-14 17:09 (:0.0)root - pts/1 2014-05-14 18:51 (192.168.1.17)root - pts/2 2014-05-14 19:48 (192.168.1.17)

Show only current user

# who -m -HNAME LINE TIME COMMENTroot pts/1 2014-05-14 18:51 (192.168.1.17)

Reduced mode display

# who -qroot root root root# users=4

Thank you for reading this article carefully. I hope that the article "How to use Linux common commands" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

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

Development

Wechat

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

12
Report