Find system uptime in Linux

There are a few different ways to find out the system up time in Linux.

cat /proc/uptime

admin@localhost [~]# cat /proc/uptime
 306350.37 2218975.63
admin@localhost [~]#

Taking the above command one step further, we can run it in the date command to see the system start up date.

date  --date="cat /proc/uptime | awk '{print $1}'seconds ago"

uptime command

[admin@localhost ~]$ uptime
  6:25AM  up 2 days,  6:24, 3 users, load averages: 0.00, 0.00, 0.00
[admin@localhost ~]$

w command

[admin@localhost ~]$ w
  6:27AM  up 2 days,  6:25, 2 users, load averages: 0.00, 0.00, 0.00
 USER             TTY      FROM              LOGIN@  IDLE WHAT
 admin       p1       localhost.  6:09AM    13 su (bash)
 admin       p2       localhost.  6:25AM     - w
[admin@localhost ~]$

Reference links

https://www.cyberciti.biz/faq/server-uptime-command-to-find-out-how-long-the-system-has-been-running/

https://sharadchhetri.com/2013/03/18/4-different-commands-to-find-system-uptime-in-linux/

Leave a Reply

Your email address will not be published. Required fields are marked *