Pgrep命令

当使用ps命令查询某个进程的pid信息时,往往需要结合grep命令对输出的结果进行过滤,单这样使用非常不方便,而pgrep命令则正是用来查询特定进程信息的专用工具。使用pgrep命令可以根据进程的名称,运行该进程的用户、进程所在的终端等多种属性查询特定进程的pid号。
通过pgrep命令,可以只指定进程的一部分名称进行查询,可以结合“-l”选项输出对应的进程名(否则只用pid号,不便于理解)。在这里插入图片描述
结合“-U”选项查询特定用户的进程、“-t”选项查询在特定终端运行的进程。在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Paragraph grep tool. 进行段搜索的grep工具。默认以空行为段分隔符,并可以自己通过-p参数指定。使用方法与经典grep相同,只是从grep的行搜索变为段搜索。 此版本为Windows下的安装版本,安装后即可从命令行窗口中通过pgrep命令调用。附带源代码。 使用帮助 ------------------------------------ pgrep v1.00.x071127 by Programus (programus@gmail.com) ------------------------------------ An open source and free command line grep like tool. It prints out the paragraphs which contains the pattern instead of lines. Usage: pgrep [OPTION]... PATTERN [FILE] ... python pgrep [OPTION]... PATTERN [FILE] ... Search for PATTERN in each FILE or standard input and output a paragraph separated by separator. Example: python pgrep.py -i 'hello world' menu.h main.c OPTIONS: -c, --count Suppress normal output; instead print a count of matching lines for each input file. With the -v, --invert-match option, count non-matching lines. -e, --regexp=PATTERN Use pattern as the pattern; useful to protect patterns beginning with a -. -f, --file=FILE Obtain patterns from file, one per line. The empty file contains zero patterns, and therefore matches nothing. -h, --help Print this help -i, --ignore-case Ignore case distinctions in both the pattern and the input files. -l, --files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning of every file will stop on the first match. -p, --separator=SEPARATOR Specify a separator. The default separator is '\n\s*\n'. -v, --invert-match Invert the sense of matching, to select non-matching parts.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值