who is command or tool in Unix/Linux-based operating systems which enables the user to know who is currently logged in their system i.e who is on the System. If no option is supplied to this command, it will display the names of users currently logged in the system, along with their terminal, the time of login and the host from which they have logged in.
*** Note all the following information is tested on Ubuntu 11.10. We endeavor to keep the information up-to-date and correct, However, we cannot guarantee that information given on the site is accurate or up to date.
Syntax : who [options] [file]
Here file specify a path name of a file which can be supplied to give additional information. Default one is /etc/utmp.
General Output format : name [state] line time [idle] [pid] [comment]
- name is user’s login name
- state shows the user’s capability of writing to the terminal
- line is name of the line found in /dev
- time is time since user’s login
- idle is time elapsed since the user’s last activity and . for this means currently the user is using the system i.e not idle
- pid is user’s process id
- comment comment line in inittab.
Following table shows all the available Options which you can use with
|-a, –all||Equivalent to -b -d –login -p -r -t -T -u.|
|am i||Print the name of invoking user only i.e current terminal.|
|-b, –boot||Print the date and time of last system boot.|
|-d, –dead||Print the list of dead processes.|
|-H||Print column headings above the regular output.|
|-l, –login||Prints list of only those lines on which the system is waiting for someone to login i.e of system login processes.|
|-m||Same as who am i.|
|-p, –process||Print the list of currently active processes spawned by Init.|
|-q, –count||Print only the user names currently logged in and total number of users currently logged in.|
|-r, –runlevel||Print the current runlevel of Init process.|
|-s, –short||Print only name, line, and time. Which is the default behaviour|
|-t, –time||Print the last system clock change.|
|-u, –users||Print the list of currently logged in users.|
Here are some of the working examples of this command:
This command displays information of invoking user only. Following image illustrates this.
This command displays the user names currently logged in and total number of users currently logged in. In the following image, this command was run in the left terminal when other terminal was not open and in the other terminal when I logged in using other user id, it displays information about two users.
Some other images of showing working of this command.
Incoming search terms:
- who command (1)