shell获取进程ID的方法: pidof | pgrep | ps-A+grep+awk
来源:互联网 发布:湖南软件职业学院新闻 编辑:程序博客网 时间:2024/06/11 06:44
shell获取进程ID的方法:
我知道和实践过的有这么三种:
- ps -A |grep "cmdname"| awk '{print $1}'
- pidof "cmdname"
- pgrep "cmdname"
这三种在bash和busybox ash里面的运行结果稍有不同,
第一种完全相同,但是因为调用命令次数较多,性能上是不行的。
第二种: pidof 只能获取程序的文件名匹配到的进程号,在ash中 比如 pidof "usr/bin/telnetd" 和 pidof "telnetd"中结果不一样, 前一种结果为空,但是在bash中执行两者一样。
第三种: pgrep跟1的效果相同,因为是单一命令,比第一种性能要好得多。
所以nanoRC就改进为pgrep。
阅读全文
0 0
- shell获取进程ID的方法: pidof | pgrep | ps-A+grep+awk
- shell获取进程ID的方法
- shell获取进程ID的方法
- shell获取进程ID的方法
- [笔记]shell使用ps -ef|grep xxx时不显示grep xxx进程的方法
- 查看进程id命令pidof
- ps -aux | grep xxx, kill -s 9, pgrep --Linux下进程
- shell获取进程ID
- 【pgrep】按照grep查找显示进程
- shell脚本抽取文本文件中指定字符串的方法:sed+grep方法、awk+grep方法(必要时可以联合sed以及grep)、grep+cut方法
- shell脚本抽取文本文件中指定字符串的方法:sed+grep方法、awk+grep方法(必要时可以联合sed以及grep)、grep+cut方法
- shell脚本抽取文本文件中指定字符串的方法:sed+grep方法、awk+grep方法(必要时可以联合sed以及grep)、grep+cut方法
- shell脚本抽取文本文件中指定字符串的方法:sed+grep方法、awk+grep方法(必要时可以联合sed以及grep)、grep+cut方法
- shell脚本抽取文本文件中指定字符串的方法:sed+grep方法、awk+grep方法(必要时可以联合sed以及grep)、grep+cut方法
- shell脚本抽取文本文件中指定字符串的方法:sed+grep方法、awk+grep方法(必要时可以联合sed以及grep)、grep+cut方法
- linux 下根据进程名字获取进程的进程号PID,类似pidof,C函数
- pgrep 查询进程的工具
- pgrep 查询进程的工具
- 百练_4013:中位数
- Selenium2+Python--Mac上安装Selenium+Python+PyCharm
- scala代码风格指南--<缩进>
- 抽象方法和接口
- MyBatis打印SQL的配置方法
- shell获取进程ID的方法: pidof | pgrep | ps-A+grep+awk
- JDBC封装增删改查,增加后返回主键等方法
- 欢迎使用CSDN-markdown编辑器
- ITK spacing的问题
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener问题
- linux6.4搭建mysql主从复制
- 百练_4015:邮箱验证
- 深度学习优化函数详解(3)-- mini-batch SGD 小批量随机梯度下降
- mybatis Example条件查询