zoukankan      html  css  js  c++  java
  • pidof---找寻PID

    pidof---找寻pid

    1.根据守护进程找到pid

    [root@localhost ~]# pidof sshd
    2542 1622
    [root@localhost ~]# ps -ef | grep sshd
    root       1622      1  0 15:47 ?        00:00:00 /usr/sbin/sshd -D
    root       2542   1622  0 15:52 ?        00:00:00 sshd: root@pts/0
    root       2569   2546  0 15:53 pts/0    00:00:00 grep --color=auto sshd
    

    2.找出后台shell脚本的pid

    [root@localhost ~]# vim sleep.sh
    #!/bin/bash
    sleep 1000m
    
    "sleep.sh" [New] 3L, 25C written                                                                                                                         
    [root@localhost ~]# chmod a+x sleep.sh 
    [root@localhost ~]# ./sleep.sh &
    [1] 2572
    [root@localhost ~]# pidof sleep.sh 
    [root@localhost ~]# pidof -x  sleep.sh         # 要加-x 参数
    2572
    [root@localhost ~]# ps -ef | grep sleep.sh 
    root       2572   2546  0 15:55 pts/0    00:00:00 /bin/bash ./sleep.sh
    root       2577   2546  0 15:55 pts/0    00:00:00 grep --color=auto sleep.sh
    

    3.-o 忽略我们指定的PID

    [root@localhost ~]# pidof sshd
    2542 1622
    [root@localhost ~]# pidof sshd -o 1622
    2542
    
  • 相关阅读:
    Cocos2d-x之绘制线条
    Cocos2d-x之绘制填充不规则多边形
    unittest
    检查代码错误和代码风格问题
    命名
    二进制数据
    python 后台运行
    分页
    编码
    格式化
  • 原文地址:https://www.cnblogs.com/zhoujun007/p/11838465.html
Copyright © 2011-2022 走看看