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

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces in detail how to use the who command in the Linux system. The sample code in this article is very detailed and has a certain reference value. Friends who find it can refer to it:

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

About who

Displays the users logged in to the system. Execute the who command to know which users are currently logged into the system, and executing the who command alone lists the login account, the terminal used, the login time, and where you logged in or which X monitor you are using.

Description

The who command prints information about all users who are currently logged in.

Who syntax

Who [OPTION]... [FILE] [am i]

Option

-a,-- all is the same as the option-b-d-- login-p-r-t-T-u. -b,-- boot shows the last time the system booted. -d,-- dead shows dead progress. -H,-- heading prints a row of column headings. -- ips prints the IP address instead of the hostname. Use-- lookup to normalize based on the IP of the storage, if available, rather than the hostname of the storage. -l,-- login printing system login process. -- lookup attempts to normalize the hostname through DNS. -m prints only information about the users and hosts associated with the standard input (the terminal that issued the command). This method conforms to the POSIX standard. -p,-- process prints the active process generated by init. -Q,-- count displays all logins, as well as the count of all logged-in users. -r,-- runlevel prints the current runlevel. -s,-- short prints only the name, line, and time fields, which is the default. -t,-- time if information is available, print the time when the system clock was last changed. -T,-w,-- mesg adds a character that indicates the status of the terminal: "+" if the terminal is writable, "-" if the terminal is not writable, or "?"-u,-users prints each user's idle time and process ID. -- message is the same as-T. -- writable is the same as-T. -- help displays a help message and then exits. -- version displays version information and then exits.

Notes

If a file is specified, who collects its information from that file. Otherwise, it is read from the default file location (usually / var/run/utmp).

If the parameter "am I" is specified, who assumes the-m option.

Who instance

Linuxidc@linuxidc:~$ who

Version view

Displays the user name, line, and time of all current login sessions. For example:

Who am i

Displays the same information, but only for terminal sessions that issue commands, such as:

Linuxmi pts/3 2018-12-02 08:52

Displays "all" information and the title above each column of data, such as:

Linuxidc@linuxidc:~$ who-aH name line time idle process number remarks exit system boot 2018-12-02 07:45 run level 5 2018-12-02 07:46linuxidc?: 0 2018-12-02 07:47? 4569 (: 0)

The above is how to use the who commands collected and sorted out by the editor in the Linux system, and how to feel that the content of the website is not bad. Welcome to recommend the website to your friends.

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