uptime命令

生產環境:CentOS

[sky9890@sky9890 ~]$ cat  /etc/redhat-release 

CentOS release 6.10 (Final)

[sky9890@sky9890 ~]$ uptime  -V

procps version 3.2.8

[sky9890@sky9890 ~]$ uptime 

 19:54:34 up 18 days,  1:49,  2 users,  load average: 0.19, 0.17, 0.11

虛擬機環境:RHEL7.0

[sky@sky ~]$ cat  /etc/redhat-release 

Red Hat Enterprise Linux Server release 7.0 (Maipo)

[sky@sky ~]$ uptime  -h

Usage:

 uptime [options]   

# Tell how long the system has been running.

Options:

 -p, --pretty   show uptime in pretty format

 -h, --help     display this help and exit

 -s, --since    system up since

 -V, --version  output version information and exit

[sky@sky ~]$ uptime  -V

uptime from procps-ng 3.3.9

[sky@sky ~]$ uptime  -s

2018-12-01 19:55:52

[sky@sky ~]$ uptime  -p

up 5 minutes

虛擬機環境:Ubuntu 16.10

image.png

實戰技巧:

1.uptime procps version 3.2.8以後版本才增加"-s","-p","-h"參數;

2.說明RHEL、CentOS、Ubuntu等系統操作uptime命令時帶來區別的原因是uptime版本所致。

3.W命令與uptime有同樣功能,如下

[root@sky9890 src]# w

 21:12:30 up 18 days,  3:07,  1 user,  load average: 0.28, 0.22, 0.19

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

sky9890  pts/0    117.44.69.112    20:42    0.00s  0.06s  0.03s sshd: sky9890 [priv]

[root@sky9890 src]# uptime

 21:14:44 up 18 days,  3:09,  1 user,  load average: 0.10, 0.18, 0.17

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章