HOWTO - Viewing Uptime in Linux
By Erik Rodriguez
Check Linux Uptime, Linux uptime, users logged into Linux, uptime of linux servers
This article provides information on how to check the uptime on a Linux server. You may also wish to see the Linux cheat sheet.
Many people are confused about the concept of uptime. The number 1 determining factor of uptime is what the sys admin does to keep the machine up. Certain machines will need to be rebooted often. Others will not. Depending your OS and the role of your server, your uptime may vary. Windows machines will need to be rebooted fairly frequently because most updates require the machine to reboot for the changes to take effect. However, I've seen Linux machines that act only as DNS servers run for years at a time. The only time you will need to reboot your Linux machine is to update the kernel. All other installations and patches can be activated automatically, or simply require a service restart.
You do NOT need root privledges to check the uptime. There are two ways to do this:
[weaponx@roswell weaponx]$ w
11:15:55 up 168 days, 1:34, 5 users, load average: 3.13, 3.06, 3.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 - 4Sep06 2days 11days 0.00s login -- root
dmarks pts/0 188.8.131.52 17Sep06 19days 5days 0.07s -bash
logictec pts/1 192.168.8.50 17Sep06 19days 2days 0.08s -bash
weaponx pts/2 managment 11:03am 1.00s 0.06s 0.01s w
w is short for who. It will show you who is logged in, from where, and other info about their login times and what they are doing. You can see the uptime of this machine currently is 168 days, 1 hour, and 34 mintues. the 11:15:55 is the server time. The load averages are also displayed. The 3 figures represent the load at the last minute, last 5 mintues, and last 15 mintues.
You can also view the uptime with less information with this command:
[weaponx@roswell weaponx]$ uptime
11:22:35 up 168 days, 1:41, 5 users, load average: 3.08, 3.08, 3.02