pkill 命令

This is a introduction to *nix’s process management tools: pkill and pgrep. As this site’s domain name was pkill.info, a introduction to pkill should exist here.

这是* nix的流程管理工具的简介:pkill和pgrep。 由于该站点的域名是pkill.info,因此此处应该存在pkill的简介。

名称 (NAME)

pgrep, pkill – look up or signal processes based on name and other attributes

pgrep,pkill –根据名称和其他属性查找或通知进程

概要 (SYNOPSIS)

pgrep [-flvx] [-d delimiter] [-n|-o] [-P ppid,...] [-g pgrp,...]
[-s sid,...] [-u euid,...] [-U uid,...] [-G gid,...]
[-t term,...] [pattern]pkill [-signal] [-fvx] [-n|-o] [-P ppid,...] [-g pgrp,...]
[-s sid,...] [-u euid,...] [-U uid,...] [-G gid,...]
[-t term,...] [pattern]

描述 (DESCRIPTION)

pgrep  looks through the currently running processes and lists the process IDs which matches the selection criteria to stdout.  All the criteria have to match.  For example,

pgrep查看当前正在运行的进程,并列出与选择标准匹配到stdout的进程ID。 所有条件都必须匹配。 例如,

pgrep -u root sshd

will only list the processes called sshd AND owned by root.  On the other hand,

只会列出root拥有的名为sshd AND的进程。 另一方面,

pgrep -u root,daemon

will list the processes owned by root OR daemon.

将列出root OR守护程序拥有的进程。

pkill will send the specified signal (by default SIGTERM) to each process instead of listing them on stdout.

pkill将向每个进程发送指定的信号(默认为SIGTERM),而不是在stdout上列出它们。

选件 (OPTIONS)

-d delimiter
Sets the string used to delimit each process ID in the output (by default a newline).  (pgrep only.)

-d分隔符
设置用于分隔输出中每个进程ID的字符串(默认情况下为换行符)。 (仅限pgrep。)

-f The pattern is normally only matched against the process name.  When -f is set, the full command  line  is used.

-f该模式通常仅与进程名称匹配。 设置-f时,将使用完整的命令行。

-g pgrp,…
Only  match  processes  in  the  process  group IDs listed.  Process group 0 is translated into pgrep’s or pkill’s own process group.

-g pgrp,…
仅匹配列出的进程组ID中的进程。 进程组0转换为pgrep或pkill自己的进程组。

-G gid,…
Only match processes whose real group ID is listed.  Either the numerical or symbolical value may be used.

-G gid,…
仅匹配列出了真实组ID的进程。 可以使用数值或符号值。

-l List the process name as well as the process ID. (pgrep only.)

-l列出进程名称以及进程ID。 (仅限pgrep。)

-n Select only the newest (most recently started) of the matching processes.

-n仅选择最新的(最近启动的)匹配过程。

-o Select only the oldest (least recently started) of the matching processes.

-o仅选择最旧的(最近启动的)匹配过程。

-P ppid,…
Only match processes whose parent process ID is listed.

-P ppid,…
仅匹配列出其父进程ID的进程。

-s sid,…
Only  match  processes  whose  process  session  ID is listed.  Session ID 0 is translated into pgrep’s or pkill’s own session ID.

-s sid,…
仅匹配列出了进程会话ID的进程。 会话ID 0转换为pgrep或pkill自己的会话ID。

-t term,…
Only match processes whose controlling terminal is listed.  The terminal name should be specified  without the “/dev/” prefix.

-t学期,…
仅匹配列出其控制终端的进程。 终端名称应不带“ / dev /”前缀。

-u euid,…
Only  match  processes whose effective user ID is listed.  Either the numerical or symbolical value may be used.

-u euid,…
仅匹配列出了有效用户ID的进程。 可以使用数值或符号值。

-U uid,…
Only match processes whose real user ID is listed.  Either the numerical or symbolical value may be  used.

-U uid,...
仅匹配列出了真实用户ID的进程。 可以使用数值或符号值。

-v Negates the matching.

-v取消匹配。

-x Only match processes whose name (or command line if -f is specified) exactly match the pattern.

-x仅匹配名称(或命令行,如果指定-f)与模式完全匹配的进程。

-signal
Defines the signal to send to each matched process.  Either the numeric or the symbolic signal name can be used.  (pkill only.)

-信号
定义要发送到每个匹配进程的信号。 可以使用数字或符号信号名称。 (仅限技能)。

经营者 (OPERANDS)

pattern
Specifies an Extended Regular Expression for matching against the process names or command lines.

模式
指定扩展正则表达式以与进程名称或命令行匹配。

例子 (EXAMPLES)

Example 1: Find the process ID of the named daemon:

示例1:查找命名守护程序的进程ID:

unix$ pgrep -u root named

Example 2: Make syslog reread its configuration file:

示例2:使syslog重新读取其配置文件:

unix$ pkill -HUP syslogd

Example 3: Give detailed information on all xterm processes:

示例3:提供有关所有xterm流程的详细信息:

unix$ ps -fp $(pgrep -d, -x xterm)

Example 4: Make all netscape processes run nicer:

示例4:使所有netscape进程运行得更好:

unix$ renice +4 ‘pgrep netscape‘

退出状态 (EXIT STATUS)

0      One or more processes matched the criteria.

0一个或多个过程符合条件。

1      No processes matched.

1没有匹配的进程。

2      Syntax error in the command line.

2命令行中的语法错误 。

3      Fatal error: out of memory etc.

3致命错误:内存不足等。

笔记 (NOTES)

The process name used for matching is limited to the 15 characters present in the output of /proc/pid/stat.   Use the -f option to match against the complete command line, /proc/pid/cmdline.

用于匹配的进程名称限制为/ proc / pid / stat输出中存在的15个字符。 使用-f选项与完整的命令行/ proc / pid / cmdline匹配。

The running pgrep or pkill process will never report itself as a match.

正在运行的pgrep或pkill进程将永远不会将自己报告为匹配项。

臭虫 (BUGS)

The options -n and -o and -v can not be combined.  Let me know if you need to do this.

选项-n和-o和-v不能组合使用。 让我知道您是否需要这样做。

Defunct processes are reported.

已报废的进程。

也可以看看 (SEE ALSO)

ps(1) regex(7) signal(7) killall(1) skill(1) kill(1) kill(2)

ps(1)regex(7)signal(7)killall(1)技能(1)kill(1)kill(2)

标准品 (STANDARDS)

pkill and pgrep were introduced in Sun’s Solaris 7.  This implementation is fully compatible.

pkill和pgrep是在Sun的Solaris 7中引入的。此实现是完全兼容的。

作者 (AUTHOR)

Kjetil Torgrim Homme <kjetilho@ifi.uio.no>

Kjetil Torgrim Homme <kjetilho@ifi.uio.no>

Albert Cahalan <albert@users.sf.net> is the current maintainer of the procps package.

Albert Cahalan <albert@users.sf.net>是procps软件包的当前维护者。

Please send bug reports to <procps-feedback@lists.sf.net>

请将错误报告发送至<procps-feedback@lists.sf.net>

From Linux User’s Manual.

摘自《 Linux用户手册》。

翻译自: https://www.systutorials.com/pkill-and-pgrep-process-management-commands/

pkill 命令

pkill 命令_pkill和pgrep:流程管理命令相关推荐

  1. linux权限命令chgrp,Linux 基础——权限管理命令chown、chgrp

    一.chown命令与chgrp命令的作用 有时你需要改变文件或目录的属主,比如有人离职或开发人员创建了一个在测试或生产环境中需要归属在系统账户下的应用.Linux提供了两个命令来实现这个功能:chow ...

  2. linux组的管理命令,Linux用户与组管理命令

    1.列出当前系统上所有已经登录的用户的用户名,注意:同一个用户登录多次,则只显示一次即可. who | cut -d" " -f1 | sort -u 或 who | cut -d ...

  3. linux组的管理命令,linux 用户和组管理命令(示例代码)

    Linux 用户和组管理 组管理 groupadd命令:添加组 groupadd 选项 group_name -g GID :指定GID;默认是上一个组的GIDS+1 -r 创建系统组: groupm ...

  4. centos普通用户修改文件权限_Linux CentOS更改文件的权限与用户及用户组管理命令...

    记录下Linux CentOS更改文件的权限命令与用户及用户组管理命令,供大家参考. Linux CentOS更改文件的权限命令 chgrp  (全称:change group) groupadd t ...

  5. 实验五 进程管理命令

    1.实验目的 (1)了解如何监视系统运行状态 (2)掌握查看.删除进程的正确方法 (3)掌握命令在后台运行的用法 (4)掌握进程手工.调度启动的方法 2.常用命令 who 查看当前在线用户 top 监 ...

  6. Linux用户与权限管理命令

    目录 一.Linux用户介绍 二.用户和组相关文件 三.用户和组管理命令 四.Linux权限管理命令 一.Linux用户介绍 Linux用户类型分为三类:超级管理员用户.系统用户和普通用户 超级管理员 ...

  7. linux基础命令_Linux编程基础:常用命令

    命令格式 在学习具体命令之前,需先了解Linux常用命令的基本格式.Linux系统中的命令遵循如下的基本格式: command [options] [arguments] 其中command表示命令的 ...

  8. Linux进程管理(第二版) --进程管理命令

    进程管理命令 一.查看用户信息w 1. w显示信息的含义 TTY:说明用户登录的方式,ttyN:表示以本地终端登录;pts/N表示以远程终端登录 JCPU:以终端代号来区分,该终端所有相关的进程执行时 ...

  9. 高级shell编程笔记(第十三章 系统与管理命令)

    第十三章 系统与管理命令 在/etc/rc.d 目录中的启动和关机脚本中包含了好多有用的(和没用的)这些系统管理命令.这些命令通常总是被 root 用户使用,用与系统维护或者是紧急文件系统修复.一定要 ...

最新文章

  1. 简单配置jena在eclipse的开发环境
  2. IOS开发基础之微博项目第1天-OC版
  3. 变形金刚2_变形金刚(
  4. hdu--1075--字典树||map
  5. netbeans6.8_NetBeans IDE 8.0和Java 8的新功能
  6. python面试题总结(3)-- 数据类型(字符串)
  7. 唐刘之辩:行业知识图谱的schema构建的难点、重点与困惑
  8. 互联网晚报 | 4月15日 星期五 | 360推出元宇宙产品“N世界”;四川多地下调房贷利率;知情人士:上汽或推动复工复产...
  9. 两种方案的demo示例
  10. linux系统怎么刷新,Fedora Linux如何更新系统
  11. React Native For Android 架构初探
  12. matlab矩阵特征值分解,矩阵特征值分解与奇异值分解含义解析及应用
  13. mysql中ai是什么意思_MySQL explain用法
  14. JAVA计算机毕业设计SEOUL设计师品牌代购商城Mybatis+系统+数据库+调试部署
  15. 如何建立网站登录系统?
  16. 操作系统简史(1)东方会有新的操作系统诞生吗?让历史告诉未来
  17. 大数据开发工程师要求高么?有前景么
  18. iOS在图片上添加文字或图片
  19. CVPR 2022 | 微软提出MiniViT:极致压缩视觉Transformer
  20. 暴风酷播云二期配置_暴风播酷云二期 黑群晖

热门文章

  1. 决策树、随机森林——泰坦尼克号生死预测示例
  2. 带你理解DOM事件流
  3. 销售订单——抬头出具发票计划状态计算逻辑
  4. AnyChart入门— 10个实用示例
  5. mysql dialect配置_一步一步升级配置14:Mysql数据库,hibernate.dialect使用MySQL5_MySQL
  6. 腾讯会议麦克风设备异常怎么处理?
  7. 分享我的手机rom及常用软件介绍
  8. 2022.10.5 英语背诵
  9. 基于高校图书馆的用户画像、可视化、模型预测、推荐算法项目实现
  10. 自动化测试框架[Cypress接口测试]