在Mac OS X中为/proc/uptime [英] /proc/uptime in Mac OS X
本文介绍了在Mac OS X中为/proc/uptime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要与Linux的"cat/proc/uptime"完全相同的输出.
I need the EXACT same output as Linux's "cat /proc/uptime".
例如,使用/proc/uptime,您将获得
For example, with /proc/uptime, you'd get
1884371.64 38646169.12
1884371.64 38646169.12
但是使用任何其他Mac替代品(例如正常运行时间"),您都会得到
but with any Mac alternative, like "uptime", you'd get
20:25向上20:26,6个用户,平均负载:3.19 2.82 2.76
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.
推荐答案
知道了...
$sysctl -n kern.boottime | cut -c14-18
87988
然后我只是将其转换为可读格式(不记得如何):
Then I just converted that to readable format (don't remember how):
1天00:26:28
1 Days 00:26:28
这篇关于在Mac OS X中为/proc/uptime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文