LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I tell how long my computer has been running, or at what time it booted last (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-tell-how-long-my-computer-has-been-running-or-at-what-time-it-booted-last-4175449200/)

Quon 02-08-2013 12:32 PM

How can I tell how long my computer has been running, or at what time it booted last
 
I googled and found a command entitled uptime, which is supposed to tell me, but all it seems to tell is the current time (as you will see the time it returns changes as the current time changes).

Code:

root [ ~ ]# uptime
 12:56:26 up  1:16,  2 users,  load average: 0.70, 0.85, 1.11
root [ ~ ]# uptime
 12:58:08 up  1:17,  2 users,  load average: 1.09, 0.92, 1.10
root [ ~ ]# uptime
 12:58:18 up  1:18,  2 users,  load average: 1.07, 0.92, 1.10
root [ ~ ]# uptime
 12:58:19 up  1:18,  2 users,  load average: 1.07, 0.92, 1.10
root [ ~ ]# uptime
 12:58:21 up  1:18,  2 users,  load average: 1.07, 0.92, 1.10
root [ ~ ]# uptime
 13:08:22 up  1:28,  3 users,  load average: 0.86, 0.99, 1.05
root [ ~ ]#

Is there any other method of determining how long it has been since I powered on? (or getting that info from the uptime command?)

Habitual 02-08-2013 01:10 PM

Code:

last reboot
who -b


rahulkya 02-08-2013 01:31 PM

the uptime shows a rough value
Quote:

13:08:22 up 1:28, 3 users, load average: 0.86, 0.99, 1.05
here
Quote:

1:28
shows the time ..here its in hours
that means your system has been up from 1 hour 28 mins

Mine is
Quote:

rahul@rahul-Aspire-5742 ~ $ uptime
00:57:17 up 17 min, 2 users, load average: 0.27, 0.77, 0.47
So mine system uptime is 17 mins

suicidaleggroll 02-08-2013 01:31 PM

uptime is already telling you that information in the 2nd column. The uptime was 1 hour and 16 minutes the first time you ran it, 1:28 the last time. On my machine:
Code:

$ uptime
 12:31:59 up 538 days, 23:01,  2 users,  load average: 0.01, 0.02, 0.00

It's been up for 538 days, 23 hours and 1 minute.

ted_chou12 02-09-2013 04:05 PM

And mine:
Code:

# uptime
 06:04:04 up 81 days, 10 min, load average: 0.27, 0.26, 0.20

is 81 days and 10 minutes.
There are many people that make linux machines server, and actually keep them ongoing, so uptime is a useful function.
Ted

schneidz 05-02-2013 08:02 AM

Quote:

Originally Posted by suicidaleggroll (Post 4887218)
uptime is already telling you that information in the 2nd column. The uptime was 1 hour and 16 minutes the first time you ran it, 1:28 the last time. On my machine:
Code:

$ uptime
 12:31:59 up 538 days, 23:01,  2 users,  load average: 0.01, 0.02, 0.00

It's been up for 538 days, 23 hours and 1 minute.

no kernel update in the last 1.5 years :) ?

heres mine:
Code:

[schneidz@hyper ~]$ w
 09:01:24 up 112 days, 16:59,  4 users,  load average: 0.59, 0.55, 0.51


suicidaleggroll 05-02-2013 09:03 AM

Quote:

Originally Posted by schneidz (Post 4943324)
no kernel update in the last 1.5 years :) ?

Old system, no internet access, only used for storage. Its OS is WAY past EOL.

flirek 05-02-2013 12:30 PM

Quote:

Is there any other method of determining how long it has been since I powered on? (or getting that info from the uptime command?)
try this:

cut -d" " -f1 /proc/uptime`

that is number of seconds since boot.


All times are GMT -5. The time now is 09:19 AM.