Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

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

share|improve this question
    
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
1  
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
add comment

4 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
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 I know, therefor my remark, but I commented because it adds something to the answer given by –  Bernhard Dec 26 '12 at 11:30
1  
@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
show 3 more comments

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 have linux, look at the date of creation of your /root/ directory. If you have windows, it will be worse...

share|improve this answer
add comment

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

share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.