zoukankan      html  css  js  c++  java
  • linux 系统中pgrep命令

    linux系统中pgrep用于查找进程

    1、查找与命令相关的进程

    [root@centos79 test]# pgrep sort
    [root@centos79 test]#

    启动一个sort命令测试:

    [root@centos79 test]# seq -f test%03g 100000000| sort | uniq -c
    [root@centos79 test]# pgrep sort  ## 另外一个终端
    18521
    [root@centos79 test]# pgrep -l sort    ## -l 列出具体命令
    18521 sort

    2、-u查找与用户相关的进程

    [root@centos79 test]# pgrep -u root | head
    1
    2
    4
    6
    7
    8
    9
    10
    11
    12
    [root@centos79 test]# pgrep -l -u root | head
    1 systemd
    2 kthreadd
    4 kworker/0:0H
    6 ksoftirqd/0
    7 migration/0
    8 rcu_bh
    9 rcu_sched
    10 lru-add-drain
    11 watchdog/0
    12 watchdog/1

    3、-l ,-u + 命令关键字 查找与用户指定命令相关的进制

    [root@centos79 test]# pgrep -l -u root | tail
    18314 kworker/0:0
    18328 kworker/1:5
    18329 kworker/1:6
    18421 kworker/3:1
    18489 kworker/3:0
    18491 kworker/u256:2
    18502 kworker/0:2
    18568 kworker/0:1
    18577 sleep
    18584 tail

    利用root启动一个sort命令: 

    [root@centos79 test]# pgrep -l -u root sort

    在另一个终端测试查找:

    [root@centos79 test]# pgrep -l -u root sort
    18612 sort
  • 相关阅读:
    django学习笔记
    linux安装tree命令
    SecureCRT卡死的问题
    vim常用快捷键记录
    项目经理应具备的9种能力
    regsvr32命令
    通知栏构建和取消的基本认识
    AlertDialog 对话框 5种
    异步任务——AsyncTask的初步认识
    BaseAdapter的使用与优化
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15039036.html
Copyright © 2011-2022 走看看