首页 > 系统相关 >pgrep:根据名称或其他属性查找进程(查找系统中running状态的进程)

pgrep:根据名称或其他属性查找进程(查找系统中running状态的进程)

时间:2023-02-01 19:46:15浏览次数:44  
标签:code name -- list running 查找 pgrep 进程 match

用法示例

# 根据名称过滤
dewan Work ~/code/shell% pgrep qemu
3570191

dewan Work ~/code/shell% pgrep qemu -l
3570191 qemu-system-x86

dewan Work ~/code/shell% pgrep qemu -a
3570191 /usr/bin/qemu-system-x86_64 -name guest=centos7,debug-threads=on ...

# 根据运行状态过滤
dewan Work ~/code/shell% pgrep -ar R  # R,running 就绪状态
2261 /usr/bin/gnome-shell
3804 /usr/libexec/gnome-terminal-server

命令帮助

dewan Work ~/code/shell% pgrep -h

用法:
 pgrep [options] <pattern>

选项:
 -d, --delimiter <string>  specify output delimiter
 -l, --list-name           list PID and process name
 -a, --list-full           list PID and full command line
 -v, --inverse             negates the matching
 -w, --lightweight         list all TID
 -c, --count               count of matching processes
 -f, --full                use full process name to match
 -g, --pgroup <PGID,...>   match listed process group IDs
 -G, --group <GID,...>     match real group IDs
 -i, --ignore-case         match case insensitively
 -n, --newest              select most recently started
 -o, --oldest              select least recently started
 -P, --parent <PPID,...>   match only child processes of the given parent
 -s, --session <SID,...>   match session IDs
 -t, --terminal <tty,...>  match by controlling terminal
 -u, --euid <ID,...>       match by effective IDs
 -U, --uid <ID,...>        match by real IDs
 -x, --exact               match exactly with the command name
 -F, --pidfile <file>      read PIDs from file
 -L, --logpidfile          fail if PID file is not locked
 -r, --runstates <state>   match runstates [D,S,Z,...]
 --ns <PID>                match the processes that belong to the same
                           namespace as <pid>
 --nslist <ns,...>         list which namespaces will be considered for
                           the --ns option.
                           Available namespaces: ipc, mnt, net, pid, user, uts

 -h, --help     显示此帮助然后离开
 -V, --version  显示程序版本然后离开

欲了解更多详细信息,请参见 pgrep(1)。

标签:code,name,--,list,running,查找,pgrep,进程,match
From: https://www.cnblogs.com/dewan/p/17083967.html

相关文章

  • Python之字典查找元素(3种方式)
    本文描述的是查找字典的某一个元素(字典遍历元素请点击->这里)上下文代码smart_girl={"name":"yuanwai","age":25,"sex":"女"} 第一种方式:[]注意:这种......
  • 二分查找算法实现(图解)与实例
    前言当我们要从一个序列中查找一个元素的时候,二分查找是一种非常快速的查找算法,二分查找又叫折半查找。 它对要查找的序列有两个要求,一是该序列必须是有序的(即该序列中......
  • linux查看进程号、端口号、服务名互查信息
    1、已知程序名称查看进程号ps-ef|grep程序名称##或者ps-aux|grep程序名称pgrep-l程序名称......
  • 进程与子进程
    一、子进程1.fork()创建子进程一个现有的进程可以调用fork()函数创建一个新的进程,调用fork()函数的进程称为父进程,由fork()函数创建出来的进程被称为子进程(child......
  • Linux系统日常进程管理与监控
    1.进程是什么进程是正在执行的一个程序或命令,每一个进程都是一个运行的实体,都有自己的地址空间,并占用一定的系统资源。在LINUX系统中进程ID用PID表示,范围从0-32768,其中PI......
  • Python服务进程管理工具supervisor使用记录
    [本文出自天外归云的博客园]学习资料supervisor文档:http://supervisord.org/running.html踩坑总结问题1:提示找不到一些包含/tmp的路径需要修改supervisord.conf配置文......
  • 9.搜索查找命令
      查找当前目录下的文件  查找规定目录下的文件   *在shell中表示通配符,表示零个或多个字符。比如当前目录下有abc.c、abdd.c、abeff.c。可以用lsab*.c来......
  • 代码随想录算法训练营第一天|704.二分查找、27.移除元素
    LeetCode704.二分查找(C++)题目链接:704.二分查找力扣leetCode二分查找算法思路:二分查找需要保证数组为有序数组同时无重复元素,否组无法通过二分查找进行判断(结果无法唯......
  • 项目运行报错:目标进程已退出,但未引发 CoreCLR 启动事件。
      项目运行报错:目标进程已退出,但未引发CoreCLR启动事件。请确保将目标进程配置为使用.NETCore。如果目标进程未运行.NETCore,则发生这种情况并不意外。 解决方......
  • Windows 命令行关闭进程
    TASKKILLTASKKILL[/Ssystem[/Uusername[/P[password]]]]{[/FIfilter][/PIDprocessid|/IMimagename]}[/T][/F]描述:使用该工具按照进程......