zoukankan      html  css  js  c++  java
  • pgrep 查询进程的工具

    pgrep

    1:简介

      pgrep 是通过程序的名字来查询进程的工具,一般是用来判断程序是否正在运行。在服务器的配置和管理中,这个工具常被应用,简单明了;

    1:用法

    #pgrep 参数选项 程序名
      常用参数
      -l 列出程序名和进程ID;
      -o 进程起始的ID;
      -n 进程终止的ID;
      举例:
      

    [root@localhost ~]# pgrep -lo httpd
      4557 httpd
      [root@localhost ~]# pgrep -ln httpd
      4566 httpd
      [root@localhost ~]# pgrep -l httpd
      4557 httpd
      4560 httpd
      4561 httpd
      4562 httpd
      4563 httpd
      4564 httpd
      4565 httpd
      4566 httpd
      [root@localhost ~]# pgrep httpd
      4557
      4560
      4561
      4562
      4563
      4564
      4565
      4566
    root@VM_160_34_centos:~/shell> AAA="'pgrep httpd'"
    root@VM_160_34_centos:~/shell> echo AAA
    AAA
    root@VM_160_34_centos:~/shell> echo $AAA
    'pgrep httpd'
    root@VM_160_34_centos:~/shell> AAA="`pgrep httpd`"
    root@VM_160_34_centos:~/shell> echo $AAA
    
    root@VM_160_34_centos:~/shell> pgrep httpd
    root@VM_160_34_centos:~/shell> echo $?
    1
    root@VM_160_34_centos:~/shell> pgrep nginx
    26192
    26193
    26194
    root@VM_160_34_centos:~/shell> AAA="`pgrep nginx`"
    root@VM_160_34_centos:~/shell> echo $?
    0
    root@VM_160_34_centos:~/shell> echo $AAA
    26192 26193 26194
    root@VM_160_34_centos:~/shell> 
  • 相关阅读:
    ExportToExcel(工作笔记)
    EXCEL中的公式
    HTML基础(二)
    .NET开发人员必知的八个网站
    HTML基础(一)
    Extjs学习笔记(消息框)
    The diff between throw and throw e
    工作中遇到的一些小知识点(备查)
    ASP.NET页面在IE缓存问题的解决
    URL中的"#"
  • 原文地址:https://www.cnblogs.com/mjorcen/p/3791439.html
Copyright © 2011-2022 走看看