So who are you...what is recorded in your
The most exacting way to find out is to look at the passwd and
group files themselves. We will talk about reading files a bit later.
But another quick way to check who you are
is to use the "who" utility. To do so, simply type "who am i" at the
command line. UNIX will respond with your username. Sometimes when you
are switching between multiple accounts, this utility can be very handy.
For a more detailed response, you might try the "id"
utility that gives you your userid and groupid.
Okay, here is a test...when you typed in "who am i" at the
command line, what utility were you using? Well the answer to that is you were
using the "who" utility. "am" and "i" were simply options to the "who" utility.
As you might expect, who has several other options that you may find very
useful. The following table outlines those options
|If you want to sort the output
of who, you can use "who | sort". Likewise, if you are only
interested in a certain user, you might pipe the output
of grep such as "who | grep selena". We will talk more
about grep tomorrow. however, always remember that although a user
may be logged in, they may not be looking at their monitors.
Sometimes people even go home with their accounts logged in!
||Responds with the list of users currently logged on as well as their last
||Responds with your own username
||Responds with UNIX accounting information
||Indicates if the terminal is set to allow messages from other users
||Lists lines waiting for login
||Displays the header line
||Displays a space separated list of usernames and a list count.
||lists expired processes that have not been respawned
||Notes the last time the system date was changed
||Displays all available info
||Just like the -u option but displays only name, line and time
||Specifies an alternative file from which to get login info.
||As you can see, the "who" utility provides a great deal of
information about what is going on with the system. However, to learn more,
you can also try the "whodo" utility.
The "whodo" utility is used to see who is on the system, and
what they are doing at the moment.
|Notice that the "whodo"
utility reports what the user is currently doing. For example, in
the above figure, I know that user selena is running PINE in one window
and the "whodo" utility in another. There are several utilities that
people can use to snoop on you in this way. For the most part,
you needn't be worried, however if you ever want to hide what you are
doing to the average snooper, you can create a shell script that
simply executes the program you are interested in. For example,
if you want your boss to think you are working on Excel rather than web surfing, you
might create a shell script called Excel.exe that simply calls netscape in
the background. The "whodo" or "ps" utilities will display a fake executable.
Of course, the serious snooper can figure that out!
The same information and more can be obtained from
the "w" utility that also displays the number of users logged in, how long the system
has been up, and the system load average. The "w" utility uses the following
||Censors the header line
||The default option that produces a display with the following fields:
User, the users terminal, the time the user logged in, the amount of time the user has been idle,
the number of minutes that the user has used of CPU time, the number of minutes used
by the users current process, the process the user is currently running.
||An appended version of the above including only username, terminal, idle time, and
the current process.
||Displays only the header line.
||A space delimited list with which to limit the output. Any user not in
this list will not be checked by the w command.
Okay, that was a big chunk. Why not
try some of these commands yourself and see who else is sharing
your UNIX system.
By the way, you can also change who you are
logged in as by using the "su" utility, or which group you are in
by using the "newgrp" utility. Of course, you will have to have
the privileges or the passwords involved. Below is an example of
the utilities in action using the "id" utility to keep track. I
logged in as user "selena", changed to user "erict" and then changed my
group to "www". Notice that you must "exit" from each change of
identity to get back to the previous state.
Table of Contents