whoson - display users logged on to various machines
whoson [ -long [ -titles ] ] [ -verbose ] [ -list ] [ -bg ]
[ -nohostfile | -noetchosts ] host_pattern
whoson displays users who are logged on to certain hosts, as
specified by the host_pattern provided. It can use either
its own host database, or the /etc/hosts file, or both, in
searching for matches to the host_pattern pattern. The user
can also override the default host database by creating a
file called .whoson-db in their home directory.
When run, whoson uses the user-provided host_pattern to
search for matching hosts, consulting first the host
database file, and then, if no matches were found, the
/etc/hosts file (this behavior can be modified through the
use of the -nohostfile and the -noetchosts options,
discussed below). When a match is found, the rusers(1C)
command is used to display who is logged onto that host, and
matching continues. The -long, -titles, and -verbose
options can be used to control the format of the output.
If the file .whoson-db exists in the user's home directory,
then it is used completely in place of the standard host
database. Of course, the .whoson-db file must follow the
strict formatting requirements of the host database.
Requests for additional hosts to be added to the host
database can be sent to the author of this program, shown
The host_pattern pattern can be a standard egrep(1V) style
regular expression. If the host_pattern is not provided on
the command line, then all hosts in the database will be
matched (if only /etc/hosts is being used, then only hosts
on the local network will be matched). If the host_pattern
is provided, then that pattern is used to match the pattern
field in the host database, or the hostname field in
Normally, the program runs sequentially through the hosts
which it finds. However, the -bg option may be used to
background each call to the rusers(1C) command. This allows
much faster execution time, but output will be unordered,
and the process table can fill up quite easily. This option
should be used when piping the output of whoson to another
program, such as grep(1V). This is useful if you are trying
to locate a particular user, instead of listing all users on
a particular host(s).
This is the pattern which will be used for host
matches, using either the host database or the
/etc/hosts file. It is recommended that only
alphanumeric characters are used in this expression,
since certain regular expression notations can cause
whoson to fail.
If the host_pattern is omitted, then whoson will either
match all database hosts (if using the host database),
or will match all hosts on the local network (if using
Display output in a long format fashion, printing
detailed information for each user. The default short
format uses one line of output per hostname. This
option may be abbreviated as `-l'.
Print title lines (column headers) for output in the
long format. The `-long' option must be specified with
this option. This option may be abbreviated as `-t'.
Make whoson inform you what it is doing. This option
is also required in order to display host information
from the host database. This option may be abbreviated
Display all possible patterns from the host database.
This allows a user to see what matches are available.
The program will exit after displaying the patterns.
-bg Run each rusers(1C) call in the background, greatly
speeding up execution time, but causing output to occur
in an unordered fashion. This option is most useful
when piping the output of whoson into another program.
Do not consult the host database when searching for
host matches. In this case, only /etc/hosts is used
for host searches. Be careful when using only
/etc/hosts for searches, since many unwanted matches
may be found, and some of these probably cannot provide
any user information anyway. In general, it is best to
use the host database when possible, since it has been
customized to provide proper hostnames. Both
-nohostfile and -noetchosts cannot be specified at the
Do not consult the /etc/hosts file when searching for
host matches. Normally, the /etc/hosts file is only
used if a match fails when using the host database.
This option inhibits that action, causing the program
to exit if a match fails when using the host database.
Both -nohostfile and -noetchosts cannot be specified at
the same time.
Display the whoson usage message.
Display users (short output format, no titles, non-
verbose mode) logged into hosts matching the string
vccsouth from the host database. If no match is found,
then search for matches in /etc/hosts.
whoson -l vccsouth
Same as above, but use the long output format instead.
No title lines will be printed, and no verbose output
will be displayed.
whoson -l -t vccsouth
Same as above, but print title lines also.
Display users (short output format, non-verbose mode)
logged into hosts from the host database matching the
pattern vcc. This could include entries for vccnorth,
vccnw, vccsouth. Executing this command with the
-nohostfile option would not be useful, since the
/etc/hosts file contains extra entries with vcc in
them, many of which cannot provide user information.
whoson -bg vcc | grep zalewk
Find out if the username "zalewk" is logged into any
hosts matching the pattern vcc. Each host is checked
in the background, which speeds up the location of the
whoson -noetchosts remote
Search the host database for the pattern remote, and
display users on remote machines. If no match is
found, do no consult the /etc/hosts file at all.
whoson -nohostfile vccnorth[a-f]
Search the /etc/hosts file for hosts matching the
regular expression vccnorth[a-f]. It does not make
sense to use that regular expression to match hosts
from the host database. Thus the presence of the
The master host database.
The user's own host database, which overrides the
The system host database.
Kenny Zalewski, firstname.lastname@example.org
A timeout mechanism should be implemented so that the wait
imposed by running rusers(1C) with a host that is not
responding can be minimized.
Certain regular expressions will break whoson. It is best
to stick with simple strings for pattern matching.