Team w Linux

Team w — “sister” team, who, about which we already wrote. It works, thanks to the same service program. Using w Linux users get information about accounts that were active in the system after the computer is turned on, and the actions played with each account.

Using the w command, you can see the names of active accounts, the time of their registration in the system and the omission of the name of the terminal connected to standard input (tty), as well as JCPU (the time used by all processes running tty) and PCPU (the time used by the current process). Current processes that occupied each of the accounts will also be displayed in the command output.

The syntax and options of the w

The command w in the user terminal looks like this:

$ w option imaagine

However, do not have to bother — you can write only the letter w. In this case, the utility will report all available data about all accounts. If you want to get information without too much “garbage” is to ask the team one or more parameters. Currently available are these options:

  • -h (–no-header) — the rejection of the output header.
  • -u (–no-current) — order to determine the JCPU and PCPU, ignoring the account names.
  • -s (–short) — short output format.
  • -f (–from) — control host name or IP address that was logged into the system.
  • -i (–ip-addr) — change of the information about the host name to an IP address.
  • -o (–old-style) — display output in the old format.

Examples of using command w

Let’s start with the simplest option — command without options:

w

Its use is justified if needed to obtain complete information about all accounts, working on the computer. The output looks like this:

If w linux to use the option -h, the headers of the columns will disappear. Beginners to do not worth it, and you’ll have to read the output at random.

w-h

Those who, regardless of the presence or absence of headers does not quite understand what was going on in the command output, give a hint-the transcript:

  • USER – the name of the account.
  • TTY – terminal name.
  • FROM – the host name or IP address from which the user logged in under a specific account.
  • LOGIN – the times when one or the other account for the first time since the introduction of machines registered in the system.
  • IDLE – time when the user showed activity with a specific account.
  • JCPU – the time used by all processes running in the terminal tty.
  • PCPU – time used by current process (this is what you can see in the WHAT column).
  • WHAT is the current process and the busy user under a specific account.

Option -u instructs the command to count the time used by the current process and all processes in the tty, not paying attention to the names of the accounts. Use it should be as an administrator (by adding it before the command su or sudo):

w sudo-u

For comparison, the screenshot shows the output of the command with the parameter -u and without it.

Option -s significantly reduces the amount of data output by the team. Time login, JCPU and PCPU will not be shown.

w-s

But -f can work in different ways. Depending on how you configured utility w this option enables or disables the output of the hostname (the FROM column in the terminal). If by default the output is enabled, the host name will be excluded from the list of exhibited data. Otherwise, the hostname will appear in the command output.

w-f

Instead of the host name display the IP address, just use the command w c the option -i.

w-i

Longtime Linux users will appreciate the option -o. If you apply it to the team w, the output will look like before — instead of a numeric data columns for IDLE, JCPU and PCPU appear empty lines. However, this will happen only under one condition — when the amount of time counted by the command is less than 60 seconds.

w-o

All of these options can be combined together in various combinations. For example, to get a shorter output, in which the columns are not signed, you need to type in the terminal:

w-sh

As for the name of the account, then it makes sense to specify in the command, if there are several different accounts (for example, admin, user, and guest_session_for_cat_Murzik).

Insights

Team w Linux systems performs the important function — provides the user with information about the activity that was on the computer accounts.

If you have any questions concerning the work of this team, do not hesitate to ask them in the comments to this article. And also write what else you would be interested in reading — it is quite possible that the article on your proposed topic will soon appear on the site.

Source: losst.ru

(Visited 4 times, 1 visits today)