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 and sqlyog installation tutorial with pictures and text

1. MySQL 1.1 MySQL installation mysql-5.5.27-winx...

How to use Dockerfile to build images in Docker

Build the image Earlier we used various images fo...

XHTML tags have a closing tag

<br />Original link: http://www.dudo.org/art...

Detailed summary of MySQL and connection-related timeouts

MySQL and connection related timeouts Preface: To...

About the configuration problem of MyBatis connecting to MySql8.0 version

When learning mybatis, I encountered an error, th...

Introduction to fork in multithreading under Linux

Table of contents Question: Case (1) fork before ...

Linux Jenkins configuration salve node implementation process diagram

Preface: Jenkins' Master-Slave distributed ar...

JavaScript Reflection Learning Tips

Table of contents 1. Introduction 2. Interface 3....

Detailed explanation of FTP environment configuration solution (vsftpd)

1. Install vsftpd component Installation command:...

Some questions about hyperlinks

I am very happy to attend this episode of potato ...

How to compile and install PHP and Nginx in Ubuntu environment

This article describes how to compile and install...

Steps to build a Docker image using Dockerfile

Dockerfile is a text file that contains instructi...