One easy method for determining how long a system has been running a session is to use the UPTIME command. This
command displays not only the length of the session, but the time it started up, how many users are connected, and the load averages of each user. The following is typical of the output of this command:
# uptime 12:30PM up 2 days, 24 mins, 4 users, load averages: 4.23, 12.36, 8.34, 15.10
UPTIME displays the current time, the session length, current number of logged in users, and the load average. The load average measures how many runnable processes are occurring over an interval. The load averages shown here are for the last 1, 5, and 15 minutes. Different versions of Unix implement the UPTIME command in different ways, so it's a good idea to check the MAN files for this command to see if there are additional capabilities.
Essentially, the UPTIME command displays the header line of the more general W command. The W command displays "Who is on the system?" Along with the above header, the W command also outputs a user's login terminal, their login time, and the current command that that user is running. The WHO, WHOAMI, and the FINGER commands are related to the W command, giving specific information about current users. Sample output of the W command is shown below:
$ w 12:30PM up 2 days, 24 mins, 4 users, load average: 4.23, 12.36, 8.34, 15.10 User tty login@ idle JCPU PCPU what carol ttyq1 11:01am 47 2:15 w barry ttyq2 8:45am 3:35 mail
Either of these commands can help you keep track of your network, especially if you are new to Unix.
Barrie Sosinsky is president of consulting company Sosinsky and Associates (Medfield MA). He has written extensively on a variety of computer topics. His company specializes in custom software (database and Web related), training and technical documentation.