Introduction to who command examples in Linux

Introduction to who command examples in Linux

About who

Displays users logged into the system. Executing the who command will tell you which users are currently logged into the system. Executing the who command alone will list the login account, the terminal used, the login time, and where they logged in from or which X display they are using.

describe

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

who syntax

who [ OPTION ]... [ FILE ] [ am i ]


Options

-a , --all Same as using options -b -d --login -p -r -t -T -u.
-b , --boot Displays the time of the last system boot.
-d , --dead Display dead processes.
-H , --heading Print a row of column headers.
--ips Print IP addresses instead of hostnames. With --lookup, canonicalize based on the stored IP (if available) instead of the stored hostname.
-l , --login Print system login process.
--lookup Try to canonicalize the hostname via DNS.
-m Print only information about the user and host associated with standard input (the terminal from which the command was issued). This method complies with the POSIX standard.
-p , --process Print active processes spawned by init.
-q , --count Displays all login names, and a count of all logged in users.
-r , --runlevel Print the current runlevel.
-s , --short Print only the name, line, and time fields, which is the default.
-t , --time Prints the time the system clock was last changed, if the information is available.
-T , -w , --mesg Adds a character that indicates the state 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 Same as -T.
--writable Same as -T.
--help Displays a help message and then exits.
--version Display version information and then exit.

notes

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

If the argument "ami" is specified, who assumes the -m option.

who Example

linuxidc@linuxidc:~$ who

Version View


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

who am i

Displays the same information, but only for the terminal session in which the command was issued, for example:

linuxmi pts/3 2018-12-02 08:52 (:0.0)

Displays "all" information along with a heading above each column of data, for example:

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:46

linuxidc ? :0 2018-12-02 07:47 ? 4569 (:0) 

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM.

You may also be interested in:
  • A brief discussion on whoami and who commands in Linux

<<:  Installation tutorial of MySQL 5.7 green version under windows2008 64-bit system

>>:  js to implement the snake game with comments

Recommend

MySQL query syntax summary

Preface: This article mainly introduces the query...

How to install docker on centos

Here we only introduce the relatively simple inst...

Multiple ways to insert SVG into HTML pages

SVG (Scalable Vector Graphics) is an image format...

Implementation of importing and exporting docker images

Docker usage of gitlab gitlab docker Startup Comm...

Use of MySQL triggers

Triggers can cause other SQL code to run before o...

Why Google and Facebook don't use Docker

The reason for writing this article is that I wan...

Install Docker on Centos7 (2020 latest version available, just copy and paste)

Refer to the official documentation here for oper...

Summary of methods to include file contents in HTML files

In the forum, netizens often ask, can I read the ...

Detailed Introduction to the MySQL Keyword Distinct

Introduction to the usage of MySQL keyword Distin...

MySQL stored procedure in, out and inout parameter examples and summary

Stored Procedures 1. Create a stored procedure an...