I need the EXACT same output as Linux's "cat /proc/uptime".
For example, with /proc/uptime, you'd get
1884371.64 38646169.12
but with any Mac alternative, like "uptime", you'd get
20:25 up 20:26, 6 users, load averages: 3.19 2.82 2.76
I need it to be exactly like cat /proc/uptime, but on Mac OS X.
Your Mac system displays its uptime in the System Information window. Click the Apple menu icon on the bar at the top of your screen, hold down the Option key, and click System Information. Scroll down in the left pane, select Software, and look for “Time since boot” to see your Mac's uptime.
There are no /proc in macOS, however I want to get infomation about my system such as: /proc/loadavg. /proc/cpuinfo.
Using /proc/uptime Shows how long the system has been on since it was last restarted: $ cat /proc/uptime 350735.47 234388.90. The first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds.
Navigate to Settings>Users to access the Users menu. You can create and manage multiple users on an account, update your profile or change the password on a user account.
Got it...
$sysctl -n kern.boottime | cut -c14-18
87988
Then I just converted that to readable format (don't remember how):
1 Days 00:26:28
There simply is no "/proc" directory on the Macintosh.
On MacOS, you can do a command like:
sysctl kern.boottime
and you'll get a response like:
kern.boottime: { sec = 1362633455, usec = 0 } Wed Mar 6 21:17:35 2013
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With