The name of the Linux team who fully displays its functionality — it is used to retrieve information about users that are connected to the system, including about terminal sessions through which you are connecting.
The command uses the data from the file /etc/utmp, although it is possible to register the terminal and another file (typically using the /etc/wtmp or /etc/inittab).
The syntax of this command is quite simple and looks like this:
who options filename arguments
In General, you can use who without any options or arguments. In this case, it displays the default dataset about the accounts connected user — the user name, the name of the user terminal, the connection time.
You can also write the command in the form of who am i — then it will identify specifically the user who now works in the terminal (similar to the-m option).
Using various options, you can get exactly the information that is needed here and now:
- -a (–all) — includes all the basic options.
- – b (–boot) — shows the time of loading the operating system.
- -d (–dead) — displays the list of zombie processes.
- – H (–heading) — does not affect the information you receive, but adds column headers, and help to understand what is where.
- -m — show the user who now works in the terminal.
- -r — display current runlevel (runinit);
- -t — show last updated the system clock;
- -s — display only name, terminal session and time.
- -q — print the number of authorized users.
- -T — data on a terminal session.
- -u — show active users.
- –ips instead of host names shows ips.
- –lookup — used in combination with –ips displays data based on stored IP, if available, and not on the hostname.
Examples of usage who
Using the option -a, we get the maximum of data that the team is ready to provide us with no additional instructions. In composition this option consists of option -b, -d, –login, -p, -r, -t, -T, -u:
This data more than the simple use who:
To see only the system boot time, simply write in the terminal:
Need to find out the current runlevel (runinit)? This is a team who in conjunction with the-r option:
When you use the-s option displays the values of NAME, LINE and TIME — information identical to what is obtained without the use of any options. All the same, but with the addition of data on the state of a terminal session shows the option-T.
The state is able to receive messages from other terminals. If the name of the terminal line is ” + ” as in the screenshot, so messages can be accepted from any third-party terminal, otherwise the value takes the form “-“. If instead of a plus or minus there is a question mark, the line is faulty:
Not mentioned in the manual option is -q, however, it works, bringing information on the number of users in the system:
Using -u you can find information about those users that are active at the moment:
On the same screen visible changes that occur when using the option -H — u columns of data the captions.But with zombie processes, which shows the-d option:
By the way, the field EXIT if this option is not displayed. To see it, use -a.
The team who Linux is an interesting and useful tool for Linux users. With its help, you can find all the information available about the users that are active in the system now or have been active before. We did our best to tell you about the rules and nuances of who, however, if you have any questions, ask them in the comments.