first boot

Discussion in 'General Mac Discussion' started by greatm31, Nov 18, 2004.

  1. macrumors member


    Oct 19, 2001
    Hey. Is there any way I can find out the date of the first boot of my powerbook? It was only a few months ago and I've been running Panther the whole time. Thanks!
  2. macrumors Penryn


    Jul 11, 2003
    Not sure what you are asking here. If you have been running it without a re-boot all that time and you want to find out how long you have been up, the answer is yes, there is a way.

    Launch Terminal and type "uptime". (without quotes)
  3. macrumors 65816


    Jan 23, 2003
    Southern California
    The Unix side of OS X keeps track of logins and reboots in the file /var/log/wtmp. The 'last' command reads this file and prints information in human-readable form. Only problem? Every month OS X cleans out the log file and starts a new one. It saves the previous 5 months of wtmp files, so if the date you're looking for is in the last 5 months, you should be in luck. Here's what you'll need to do:

    Open up Terminal. First you want to get a listing of available old wtmp files:

    ls -l /var/log/wtmp*
    Mine looks like this:

    -rw-r--r--  1 root  admin  936 18 Nov 09:34 /var/log/wtmp
    -rw-r--r--  1 root  admin  496 31 Oct 23:48 /var/log/wtmp.0.gz
    -rw-r--r--  1 root  admin  251 24 Sep 08:01 /var/log/wtmp.1.gz
    -rw-r-----  1 root  admin  750 30 Aug 13:16 /var/log/wtmp.2.gz
    -rw-r-----  1 root  admin  295 30 Jun 23:12 /var/log/wtmp.3.gz
    -rw-r--r--  1 root  admin  199 31 May 13:06 /var/log/wtmp.4.gz
    (I'm missing one from the end of July because I moved on August 1st, so the machine wasn't running to do that little bit of housekeeping then)

    Find the oldest file, and unzip it:

    sudo gunzip /var/log/wtmp.4.gz
    (replace the 4 with the number of your oldest one).

    Finally, run 'last' on that file to find the reboot entry you wanted:

    last -f /var/log/wtmp.4 reboot
    To see everything logged in that file, omit the 'reboot' part. Or to see it for the current month, omit everything but the 'last' command.

    Hope this helps! ;)

Share This Page