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 who command in Linux

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

Share

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

This article is about how to use the who command in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Linux common command who command is used to show which users are on the system, the data displayed include the user ID, the terminal used, which side is connected, online time, sluggish time, CPU usage, actions, and so on.

Who displays the information of all current login users.

Summary who [OPTION]... [file] [am I] main purpose when no non-option parameters are given, print information for each current user in the following field order: login user name, terminal information, login time, remote host or X display.

When a user executes who am i, only the information of the user running the command is displayed.

The option-a,-- all is equivalent to calling'- b-d-- login-p-r-t-T-u'. -b,-- boot the last time the system started. -d,-- dead the process of printing dead status. -H,-- heading prints column header lines. -l,-- login printing system login process. -- lookup attempts to standardize hostnames through DNS. -m displays only the hostname and user associated with the standard input. -p,-- process prints the active process generated by init. -Q,-- count lists the name and number of all logged-in users. -r,-- runlevel prints the current runlevel. -s,-- short prints only the name, line, and time (default). -t,-- time prints the last system clock change. -T,-w,-- mesg,-- message,-- writable will'+, -,?' One of the is added to the user name as the message status of the user. -u,-- users lists the logged-in users. -- help displays help information and exits. -- version displays version information and exits. About the-T option,'+, -,?': 'allow to write information'-'disable writing information'?' Cannot find the end device parameter file (optional): specify file instead of the default / var/run/utmp, / etc/utmp; usually use / var/log/wtmp as a parameter to view users who have logged in to the system in the past.

A return value of 0 indicates success, while a non-zero value indicates failure.

Example [root@localhost ~] # who root pts/0 2013-08-19 15:04 (192.168.0.134) root pts/1 2013-12-20 10:37 (180.111.155.40) [root@localhost] # who-q root root # users=2 [root@localhost] # who-H NAME LINE time COMMENT root pts/0 2013-08-19 15 04 (192.168.0.134) root pts/1 2013-12-20 10:37 (180.111.155.40) [root@localhost ~] # who-w root + pts/0 2013-08-19 15:04 (192.168.0.134) root + pts/1 2013-12-20 10:37 (180.111.155.40) Note this command is a command in the GNU coreutils package For help, please see man-s 1 who,info coreutils' who invocation'.

Thank you for reading! This is the end of the article on "how to use who commands in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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