Sysctl uptime

Joshua Oreman oremanj at
Sun Jun 29 21:38:11 PDT 2003

On Mon, Jun 30, 2003 at 09:17:54PM -0700 or thereabouts, Remington L. wrote:
> Is there a sysctl string that can tell me my uptime?

No, but kern.boottime is the boot time of the kernel, so subtract that from
`date +%s` and you have uptime in seconds. Note that sysctl's output for this
field will need some parsing.

I found this out from the source code for `w', btw. Use the Source, Luke!

-- Josh

> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list