• 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
  • 相关阅读:
    光场显微成像----整理
    清华大学自动化系友论坛——光电智能计算:笔记
    大创记录——Day3.12
    2.17UI bug修复
    beta阶段UI界面改进
    关于UI设计的心得体会-alpha和beta交界期间
    1.30进度
    2018.1.28进度更新
    心·迹 项目简介
    项目组成员介绍
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15039036.html
Copyright © 2020-2023  润新知