uptime,ps 命令总结

作者: 肖金光xjg | 来源:发表于2017-03-01 10:35 被阅读34次

    uptime 查看系统负载

    uptime的输出如下:

    [root@cenos6 ~]# uptime
     08:02:43 up 19 days, 18:07,  2 users,  load average: 0.00, 0.00, 0.00
    

    解析:
    第一列: 系统当前时间
    第二列:up 系统开机运行的总长,up: 多少天,多少小时分钟
    第三列:user 系统当前在线人数
    第四列:load average(平均负载) 最近 一分钟的,五分钟的,15分钟的
    数据来自proc/loadavg

    [root@cenos6 ~]# cat /proc/loadavg 
    0.00 0.00 0.00 1/87 36502
    

    load average解释: ** 单位时间间隔内运行队列中的平均进程数 **
    假设用高速公路来表示平均负载,单CPU就是单车道。
    负载小于1时,说明车道很通畅,和0没什么区别
    负载为1时,说明单车道沾满车,
    负载为5时,说明车道外也排满4倍的车,超过400%的承受能力

    查看系统负载还有哪些命令:
    top
    w

    ps 查看系统进程

    ps -aux输出:

    [root@cenos6 ~]# ps -aux |head -n 10
    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root         1  0.0  0.3  19356   720 ?        Ss   Feb08   0:01 /sbin/init
    root         2  0.0  0.0      0     0 ?        S    Feb08   0:00 [kthreadd]
    root         3  0.0  0.0      0     0 ?        S    Feb08   0:00 [migration/0]
    root         4  0.0  0.0      0     0 ?        S    Feb08   0:00 [ksoftirqd/0]
    root         5  0.0  0.0      0     0 ?        S    Feb08   0:00 [stopper/0]
    root         6  0.0  0.0      0     0 ?        S    Feb08   0:01 [watchdog/0]
    root         7  0.0  0.0      0     0 ?        S    Feb08   7:36 [events/0]
    root         8  0.0  0.0      0     0 ?        S    Feb08   0:00 [events/0]
    root         9  0.0  0.0      0     0 ?        S    Feb08   0:00 [events_long/0]
    

    ps常用参数:
    -a 显示现行终端机下的所有进程,包括其他用户的进程;
    -u 以用户为主的进程状态 ;
    -x 通常与 a 这个参数一起使用,可列出较完整信息。

    输出列解析:
    USER: 进程所属用户
    PID: 进程PID号
    %CPU: 进程使用CPU百分比
    %MEM: 进程使用内存百分比
    VSZ: virtual memory size of the process in KiB (1024-byte units),使用虚拟内存大小
    RSS: resident set size, the non-swapped physical memory that a task has used,使用物理内存大小
    TTY: controlling tty (terminal)。 终端位置
    STAT: 进程状态
    START: time the command started. 进程启动时间
    TIME: cumulative CPU time 进程使用CPU时间
    COMMAND: 进程启动命令

    PROCESS STATE CODES

    Here are the different values that the s, stat and state output specifiers
    (header "STAT" or "S") will display to describe the state of a process.
    D Uninterruptible sleep (usually IO) 不间断的睡眠(通常是IO)
    R Running or runnable (on run queue) 程序正在运行
    S Interruptible sleep (waiting for an event to complete) 正在休眠
    T Stopped, either by a job control signal or because it is being traced. 正在侦测或者是停止
    W paging (not valid since the 2.6.xx kernel) 分页,内核2.6xx以后失效
    X dead (should never be seen) 死进程,不应该看到
    Z Defunct ("zombie") process, terminated but not reaped by its parent. 僵尸进程

    相关文章

      网友评论

        本文标题:uptime,ps 命令总结

        本文链接:https://www.haomeiwen.com/subject/pfjqgttx.html