• 几个常用的ps命令


    1. ps aux

    If you are looking for a short summary of the active processes, use  ps aux

    [root@rhel7 tmp]# ps aux |head
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root         1  0.0  0.3  44496  7124 ?        Ss   Jun27   0:01 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
    root         2  0.0  0.0      0     0 ?        S    Jun27   0:00 [kthreadd]
    root         3  0.0  0.0      0     0 ?        S    Jun27   0:00 [ksoftirqd/0]
    root         7  0.0  0.0      0     0 ?        S    Jun27   0:00 [migration/0]
    root         8  0.0  0.0      0     0 ?        S    Jun27   0:00 [rcu_bh]
    root         9  0.0  0.0      0     0 ?        S    Jun27   0:00 [rcuob/0]
    root        10  0.0  0.0      0     0 ?        R    Jun27   0:00 [rcu_sched]
    root        11  0.0  0.0      0     0 ?        S    Jun27   0:00 [rcuos/0]
    root        12  0.0  0.0      0     0 ?        S    Jun27   0:00 [watchdog/0]

    2. ps -ef 

    If you are not only looking for the name of the process but also for the exact command that was used to start the process, use ps -ef .

    [root@rhel7 tmp]# ps -ef |head
    UID        PID  PPID  C STIME TTY          TIME CMD
    root         1     0  0 Jun27 ?        00:00:01 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
    root         2     0  0 Jun27 ?        00:00:00 [kthreadd]
    root         3     2  0 Jun27 ?        00:00:00 [ksoftirqd/0]
    root         7     2  0 Jun27 ?        00:00:00 [migration/0]
    root         8     2  0 Jun27 ?        00:00:00 [rcu_bh]
    root         9     2  0 Jun27 ?        00:00:00 [rcuob/0]
    root        10     2  0 Jun27 ?        00:00:00 [rcu_sched]
    root        11     2  0 Jun27 ?        00:00:00 [rcuos/0]
    root        12     2  0 Jun27 ?        00:00:00 [watchdog/0]

    3.ps fax 

    which shows hierarchical relationships between parent and child processes.

    [root@rhel7 tmp]# ps fax | head
      PID TTY      STAT   TIME COMMAND
        2 ?        S      0:00 [kthreadd]
        3 ?        S      0:00  \_ [ksoftirqd/0]
        7 ?        S      0:00  \_ [migration/0]
        8 ?        S      0:00  \_ [rcu_bh]
        9 ?        S      0:00  \_ [rcuob/0]
       10 ?        R      0:00  \_ [rcu_sched]
       11 ?        S      0:00  \_ [rcuos/0]
       12 ?        S      0:00  \_ [watchdog/0]
       13 ?        S<     0:00  \_ [khelper]
  • 相关阅读:
    Mysql中varchar类型的猫腻!
    震惊!java中日期格式化的大坑!
    mysql数据库限制多次登录失败,限定用户重试时间
    2021年回顾与展望
    多线程循环打印abc
    2020年总结-用学习过的技术搭建一个简单的微服务框架 + 源码
    回溯算法
    PyTorch 中 weight decay 的设置
    数据结构与算法——计数排序
    数据结构与算法——堆排序
  • 原文地址:https://www.cnblogs.com/rusking/p/5623669.html
Copyright © 2020-2023  润新知