uptime

package
v0.0.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package uptime implements the uptime builtin command.

uptime — tell how long the system has been running

Usage: uptime [-ps] [--help]

With no options, print the current time, how long the system has been running, and the system load averages for the past 1, 5, and 15 minutes. User count is intentionally omitted (reading utmp would expose session information).

Options:

-p, --pretty  show uptime in pretty format
-s, --since   system up since (YYYY-MM-DD HH:MM:SS)
-h, --help    display this help and exit

Data sources (platform-specific, bypass AllowedPaths — see AGENTS.md):

Linux:   /proc/uptime, /proc/loadavg
Darwin:  sysctl kern.boottime, sysctl vm.loadavg
Windows: GetTickCount64 (no load average available)

Exit codes:

0  Success
1  Error — platform not supported, kernel read failure, or invalid flag

Index

Constants

This section is empty.

Variables

View Source
var Cmd = New(sysinfo.Get)

Cmd is the uptime builtin command descriptor using the real system-info provider.

Functions

func New

func New(getInfo func() (sysinfo.Info, error)) builtins.Command

New returns an uptime Command backed by the given system-info provider. Production code uses Cmd (backed by sysinfo.Get); tests pass a fake.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL