开始学习
< 返回

uptime 命令

介绍

uptime 命令用于显示系统运行时间。

who 命令一样,uptime 命令也会从 /var/run/utmp 文件获取系统信息,也可以从 /proc/uptime 中读取。

语法

uptime [options]

选项

  • -p, --pretty :以漂亮的格式显示正常运行时间。
  • -s, --since :以 yyyy-mm-dd HH:MM:SS 格式显示系统启动时间。
  • -h, --help :显示帮助信息。
  • -V, --version :显示版本信息。

示例

显示系统运行时间

$ uptime 
 00:00:01 up  5:27,  1 user,  load average: 0.33, 0.40, 0.33

以更便于阅读的格式显示系统运行时间

$ uptime -p
up 5 hours, 27 minutes

显示系统启动时间

$ uptime -s
2021-04-30 18:32:54
Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
Please Share Your Feedback
How Can We Improve This Article?
文章目录