# Finding computer uptime from first day until now

I need to find PC uptime from the day of installation until now.

Is this logged somewhere? Does any file log this cumulative uptime?

-
First day since manufacture? –  warl0ck Dec 26 '12 at 8:37
No, First day from OS installation(ubuntu) –  chalist Dec 26 '12 at 9:12
What is the actual problem you are trying to solve? –  jippie Dec 26 '12 at 10:13
@jippie I need to find PC uptime from first ubuntu installation day until now for loggin in my Company. –  chalist Dec 26 '12 at 11:01
@chalist no you can't. –  Ulrich Dangel Dec 26 '12 at 12:31

As log-files are usually deleted after some time, the total up-time is difficult to get.

If the hard disk is as old as the PC, the RAW value (last number) of

smartctl  -a /dev/sda | grep Power_On_Hours


could give a rough estimate how many hours the PC was used.

-
I tried. Not worked. –  chalist Dec 26 '12 at 9:16
@chalist As you're using Ubuntu, you'll also find this information via the GUI Disk Utility, but it will give you the uptime since manufacture, not since installation. –  Bernhard Dec 26 '12 at 9:27
@Bernhard I will PC uptime not Disk creation time. –  chalist Dec 26 '12 at 11:14
@chalist As I wrote in my answer: The last number in the line shows how many hours your harddrive was on. Therefore: 4583 hours = ~ 191 days. –  jofel Dec 26 '12 at 17:13
@jofel thanks a lot –  chalist Dec 26 '12 at 18:45

If you have some server, use commands like:

uptime

w

last


HDD SMARTCTL is also good try.

Also from installation could be information about date created of some files in filesystem. Think about, which files were created with installing of your system?

-

If you want to keep track of this -from now on- you can use uptimed

It's available as package in Ubuntu and Fedora and probably other distributions as well.

-

Depending on the filesystem, the superblock might have the date the filesystem was created. You'd want to check the root filesystem. There is more information here

-
Not really related to the asked uptime. –  manatwork Dec 28 '12 at 8:18
I inferred that he meant the time the system was installed, since he kept referring to installation. The actual uptime is easily obtained. –  Tim B Dec 30 '12 at 1:25