Previous Table of Contents Next

Using Basic OS Commands

Finding User Information
Finding Environment Information
Creating and Editing Files
Combining Commands and Redirecting Output
Using Manual Pages
Finding Disk Information

THIS CHAPTER EXPLAINS SOME BASIC OPERATING SYSTEM COMMANDS THAT help you find information about users and the system environment. It also describes several ways to create and edit files, combine commands and redirect output, display manual pages, and locate basic disk information.

Finding User Information

When administering systems, you often need to find out who is using the system and what they are doing. This section describes the commands—who, finger, rusers -l, whodo, id—that you can use to find information about users.

Determining Who Is Logged In to a System (who, finger, rusers -l, whodo)

You can use any one of four commands (who, finger, rusers -l, or whodo) to find out who is logged on to a system. Each command gives you different additional information.

Using the who Command

The who command displays a list of the users logged on to a system, with the login TTY port and the date and time. When a user is logged on remotely, the remote system name for that user is also displayed. To use the who command, type who and press Return.

In this example, irving is logged on remotely (as shown by the system name), and ignatz is logged in locally to the system oak:

oak% who
irving pts/1   Oct 31 14:33 (elm)
ignatz console Oct 31 12:22

Using the finger Command

The finger command displays a list of the login names of users logged on to a system, along with the user's complete name (from the Information field of their /etc/password entry), the TTY port, the day of the week, the login time, and the remote system name if the user is logged in remotely. To use the finger command, type finger and press Return.

In this example, user winsor is logged on remotely from castle:

oak% rlogin drusilla
drusilla% finger
Login  Name          TTY   Idle When      Where
winsor Janice Winsor pts/Ø 11   Thu Ø9:59 castle

Using the rusers - l Command

The rusers - l (remote users, login) command displays a list of login names of users who are logged in on remote systems, along with the name of the system a user is logged in to, the TTY port, the month, date, login time, and idle time. If the host is not idle, no time is displayed in the last field. To use the rusers -l command, type rusers -l and press Return:

cinderella% rusers -l
Sending broadcast for rusersd protocol version 3...
Sending broadcast for rusersd protocol version 2...
jah      caps:console            Mar  3 13:Ø3   22:Ø3
amber    facehole:console        Mar  2 Ø7:4Ø
sebree   ondine:console          Mar  2 1Ø:35      14
tut      cairo:console           Mar  2 1Ø:48
jrt      cairo:ttyp5             Mar  2 16:2Ø   47:54 (gap)
ramseyis mowthelawn:console      Mar  2 16:33      28
ramseyis mowthelawn:ttyp6        Mar  3 14:2Ø   25:14 (:Ø.Ø)
(More logins not shown)

This example shows six users logged in to the console and two users logged in to TTY ports.

Using the whodo Command

The whodo command displays the date, time, and system name. For each user logged in, the device name, UID, and login time are shown, followed by a list of active processes associated with the UID. The list includes the device name, PID, CPU minutes and seconds used, and process name.

To find out who is logged in and doing what, type whodo and press Return:

castle% whodo
Thu Oct  9 14:38:59 PDT 1997

console      winsor   12:56
      ?            377    0:00 Xsession
    pts/2          422    0:00 sdt_shell
    pts/2          441    0:00 ttsession
    pts/2          442    0:00 dtsession
      ?            453    0:00 snapshot
      ?            452    0:02 dtterm
    pts/3          464    0:00 csh
    pts/3          618    0:00 whodo
    pts/5          478    0:00 csh
    pts/4          474    0:00 csh
      ?            451    0:02 dtfile
      ?            489    0:00 dtfile
      ?            449    0:02 dtwm
      ?            450    0:00 dtpad
    pts/2          425    0:00 csh
      ?            387    0:00 fbconsole
      ?            423    0:00 dsdm
pts/3        winsor   12:57

pts/4        winsor   12:57

pts/5        winsor   12:57

This example shows that user winsor is running a number of CDE applications.

Finding User UID and GID Settings (id)

Use the id command to display the user ID and group ID number for a user who is logged in. This information can be helpful for troubleshooting problems when users cannot access files they think they own, or when users want to find out which group they belong to. To use the id command, have the user log in, type id, and press Return. If the UID or GID does not match those for the troublesome file, you may need to change the ownership or group on the file or add the user to the appropriate group. See Chapter 5, "Administering Network Services," for more information.

This example shows the UID for user winsor is 6693 and the GID is 10. For superuser, the UID is 0 and the GID is 0:

anastasia% id
uid=6693(winsor) gid=1Ø(staff)
anastasia% su
# id
uid=Ø(root) gid=1(other)

Previous Table of Contents Next