x uptime - System Uptime and Load
Enhanced uptime command with structured YAML output and cross-platform support.
Quick Start
CODEBLOCK0
Features
- - Structured YAML output: Easy to parse and read
- Load averages: 1, 5, and 15-minute trends
- Cross-platform: Linux, macOS, Windows (via cosmo/busybox)
- Auto-detection: Uses native, busybox, or cosmo backends
Output Fields
| Field | Description | Example |
|---|
| INLINECODE1 | Current system time | INLINECODE2 |
| INLINECODE3 |
System uptime |
5 days, 3 hours, 27 minutes |
|
users | Logged-in users count |
2 users |
|
load | Load averages (1m, 5m, 15m) |
0.52, 0.58, 0.59 |
Commands
| Command | Description |
|---|
| INLINECODE9 | YAML format output (default) |
| INLINECODE10 |
YAML format (explicit) |
|
x uptime --raw | Raw system uptime output |
Examples
Basic Usage
CODEBLOCK1
Raw Output
CODEBLOCK2
Parsing
CODEBLOCK3
Understanding Load Averages
Load averages indicate system busyness - the average number of processes waiting for CPU or I/O.
| Value | Interpretation |
|---|
| INLINECODE12 | System has spare capacity |
| INLINECODE13 |
System is fully utilized |
|
> 1.0 | Processes are waiting (queue forming) |
The three numbers show:
- - 1 min: Short-term trend (immediate load)
- 5 min: Medium-term trend (recent history)
- 15 min: Long-term trend (sustained load)
Multi-Core Systems
Divide load by CPU core count:
# 4-core system with load 3.2
effective_load = 3.2 / 4 = 0.8 # Still has capacity
Platform Notes
Linux
- - Uses native
uptime command - Full feature support
macOS
- - Uses native
uptime command - Full feature support
Windows
- - No native
uptime command - Automatically uses cosmo binary or busybox
Related
- - Native
uptime(1) manual page
x uptime - 系统运行时间与负载
增强版 uptime 命令,支持结构化YAML输出和跨平台运行。
快速开始
bash
YAML格式输出(默认)
x uptime
原始uptime命令输出
x uptime --raw
功能特性
- - 结构化YAML输出:易于解析和阅读
- 负载平均值:1分钟、5分钟和15分钟趋势
- 跨平台支持:Linux、macOS、Windows(通过cosmo/busybox)
- 自动检测:使用原生、busybox或cosmo后端
输出字段
| 字段 | 描述 | 示例 |
|---|
| time | 当前系统时间 | 14:32:10 |
| up |
系统运行时间 | 5天3小时27分钟 |
| users | 登录用户数 | 2个用户 |
| load | 负载平均值(1分钟、5分钟、15分钟) | 0.52, 0.58, 0.59 |
命令
| 命令 | 描述 |
|---|
| x uptime | YAML格式输出(默认) |
| x uptime --yml |
YAML格式(显式指定) |
| x uptime --raw | 原始系统运行时间输出 |
示例
基本用法
bash
默认YAML输出
x uptime
输出示例:
time : 14:32:10
up : 5天3小时27分钟
users : 2个用户
load : 0.52, 0.58, 0.59
原始输出
bash
传统uptime输出
x uptime --raw
14:32:10 up 5 days, 3:27, 2 users, load average: 0.52, 0.58, 0.59
解析输出
bash
提取运行时间
x uptime | awk -F: /^up/{print $2}
获取负载平均值
x uptime | awk -F: /^load/{print $2}
理解负载平均值
负载平均值表示系统繁忙程度——等待CPU或I/O的进程平均数量。
系统已充分利用 |
| > 1.0 | 进程正在等待(形成队列) |
三个数值分别表示:
- - 1分钟:短期趋势(即时负载)
- 5分钟:中期趋势(近期历史)
- 15分钟:长期趋势(持续负载)
多核系统
将负载除以CPU核心数:
bash
4核系统,负载3.2
有效负载 = 3.2 / 4 = 0.8 # 仍有容量空间
平台说明
Linux
macOS
Windows
- - 无原生 uptime 命令
- 自动使用cosmo二进制文件或busybox
相关资源