O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

who

Synopsis

who [options] [file]
who am i

Show who is logged into the system. With no options, list the names of users currently logged in, their terminal, the time they have been logged in, and the name of the host from which they have logged in. An optional system file (default is /etc/utmp) can be supplied to give additional information.

Options

-a, --all

Equivalent to -b -d --login -p -r -t -T -u.

am i

Print information for the invoking user.

-b, --boot

Print time of last system boot.

-d, --dead

Print a list of dead processes.

-H, --heading

Print column headings.

--help

Print a help message and then exit.

-l, --login

Print list of system login processes.

--lookup

Attempt to include canonical hostnames via DNS.

-m

Same as who am i.

-p, --process

Print active processes spawned by init.

-q, --count

“Quick.” Display all usernames and the total number of users.

-r, --runlevel

Print the current runlevel.

-s, --short

Print only name, line, and time. This is the default behavior.

-t, --time

Print the last system clock change.

-u, --users

Print a list of the users who are logged in.

--version

Print version information and then exit.

-w, -T, --mesg, --message, --writable

Include user’s message status in the output:

+

mesg y (write messages allowed)

-

mesg n (write messages refused)

?

Cannot find terminal device

Example

This sample output was produced at 8 a.m. on April 17:

$ who -uH
NAME    LINE   TIME         IDLE   PID  COMMENTS
Earvin  ttyp3  Apr 16 08:14 16:25  2240
Larry   ttyp0  Apr 17 07:33   .   15182

Since Earvin has been idle since yesterday ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required