Mac OS X, Mac OS X Server, Mac Security See How Long The Active User Has Logged In On A Mac December 10, 2014 The following will grab you an integer of the number of hours an active user has logged into a computer: user=$( ls -l /dev/console | awk '{ print $3 }' ) ; ac users $user | awk '{ print $2 }'