Who and how long? - Monitoring network usage

Who and how long? - Monitoring network usage

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,

    Requires Free Membership to View

    By submitting your registration information to SearchNetworking.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchNetworking.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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.


This was first published in December 2003

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.