Determine last time Mac OS X was rebooted

How can I determine the last time that a Mac OS X computer was rebooted or shut down?
IT GuyNetwork EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

johnsoneSenior Oracle DBACommented:
Use the uptime command.  That will tell you how long it has been up, you can back into when it was started from there.

Typical UNIX command would also be who -b, but Mac OS X doesn't seem to support that option.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
serialbandCommented:
OSX does support the who -b option to show the date and time of the most recent reboot.

The last command will also show a list of reboot and shutdown times, including the most recent reboot of who -b.

uptime works better for showing how long it's been up if you prefer that over who -b.
0
johnsoneSenior Oracle DBACommented:
Good to know that who -b works.  I found this man page which doesn't list it for OS X.
0
serialbandCommented:
That's a really old man page.

Here's the current one:

WHO(1)                    BSD General Commands Manual                   WHO(1)

NAME
     who -- display who is logged in

SYNOPSIS
     who [-abdHlmpqrsTtu] [file]
     who am i

DESCRIPTION
     The who utility displays a list of all users currently logged on, showing for each user the login name,
     tty name, the date and time of login, and hostname if not local.

     Available options:

     -a    Same as -bdlprTtu.

     -b    Time of last system boot.

     -d    Print dead processes.

     -H    Write column headings above the regular output.

     -l    Print system login processes (unsupported).

     -m    Only print information about the current terminal.  This is the POSIX way of saying who am i.

     -p    Print active processes spawned by launchd(8) (unsupported).

     -q    ``Quick mode'': List only the names and the number of users currently logged on.  When this
           option is used, all other options are ignored.

     -r    Print the current runlevel.  This is meaningless on Mac OS X.

     -s    List only the name, line and time fields.  This is the default.

     -T    Print a character after the user name indicating the state of the terminal line: `+' if the ter-
           minal is writable; `-' if it is not; and `?' if a bad line is encountered.

     -t    Print last system clock change (unsupported).

     -u    Print the idle time for each user, and the associated process ID.

     am I  Returns the invoker's real user name.

     file  By default, who gathers information from the file /var/run/utmpx.  An alternative file may be
           specified.

FILES
     /var/run/utmpx

SEE ALSO
     last(1), mesg(1), users(1), getuid(2), utmpx(5)

STANDARDS
     The who utility conforms to IEEE Std 1003.1-2001 (``POSIX.1'').

HISTORY
     A who utility appeared in Version 6 AT&T UNIX.

BSD                            January 17, 2007                            BSD

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apple Software

From novice to tech pro — start learning today.