A few Unix commands can provide you with answers to questions about your system: "Who is logged in?" "What are they doing?" "What jobs are taking up all my CPU cycles?" "How long has my system been up?"
uptime tells you how long it has been since you last restarted and what your workload is.
who tells you who is logged in to your system, where they're logged in from, and when they logged in.
w tells you who is online and what they are doing.
last tells you who has logged into your computer.
ps and top tell you what jobs are running on your computer.
This section explains how to use each of these commands and shows simulated output so you know what you might expect to learn.
You can learn more about these commands by viewing their man pages. In the Terminal window, type man uptime, man who, man w, man last, man ps, or man top and press
In the Terminal window, type uptime and press
The results might look something like what you see in
Code 1 . You see the current time, the time since the last restart, or boot (7 days, 17 hours, and 48 minutes), and load averages of how many active jobs were in the queue during the last 1, 5, and 15 minutes. The load shown here is high because my system is running the SETI@home screensaver. Normally these numbers will be less than 1.
uptime command.
In the Terminal window, type who and press
The results might look something like what you see in
Code 2 . In this example, I'm logged in remotely twice from the machine with the IP address 192.168.2.1, once as root and once as myself. I'm also logged in from a remote location (isaac.exploratorium.edu) and at the system console.
who command.
In the Terminal window, type w and press
The command's output looks something like
Code 3 . The w command first does an uptime command. Then it gives you information about each user, when they logged in, and how long it's been since they've done anything.
w command.
In the Terminal window, type last and press
The output should look similar to
Code 4 . The last command spews out a list of everyone who has logged in to your machine, when and from where they logged in, how long they stayed, and when you last shut down or restarted your machine.
last command.
Or
In the Terminal window, type last
user (where
user is the user name of a specific user) and press
If you specify a user, last will show only the logins for that user.
In the Terminal window, type ps and press
The ps command tells you what you are running at the instant you run the command.
Or
In the Terminal window, type top and press
The top command gives you a running commentary of the top ten jobs. If you expand the size of the Terminal window, top shows more than the top ten jobs. Press