CentOS 查看某个进程的线程
方法一
ps -T -p <pid>
方法二
top -H -p <pid>
方式一:
cat /proc/[pid]/status
展示结果中,Threads后边对应的数字就是进程拥有的线程数量
方式二:
ps hH p 3805|wc -l
根据进程号进行查询:
# pstree -p 进程号
# top -Hp 进程号
根据进程名字进行查询:
ps -p `ps -e | grep php | awk '{print $1}'`
ps -p `ps -e | grep php | awk '{print $1}'` | wc -l
ps -p `ps -e | grep nginx | awk '{print $1}'`
ps -p `ps -e | grep nginx | awk '{print $1}'` | wc -l
pstree -p `ps -e | grep server | awk '{print $1}'` | wc -l
pstree -p `ps -e | grep www | awk '{print $1}'` | wc -l
这里利用了管道和命令替换,
关于命令替换,就是说用`括起来的命令会优先执行,然后以其输出作为其他命令的参数,
上述就是用 ps -e | grep server | awk '{print $1}'
的输出(进程号),作为 pstree -p
的参数
管道和命令替换的区别是:
管道:管道符号"|"左边命令的输出作为右边命令的输入
命令替换:将命令替换符"``"中命令的输出作为其他命令相应位置的参数
使用htop,top的增强版本,能更丰富的显示信息。
版权属于: 三三世界-百宝箱
本文链接: http://33f.net/linux/centos_check_number_of_processes.html
本文最后更新于2022年04月21日 ,已超过975天没有更新,若内容或图片失效,请留言反馈。
本文允许转载,但请在转载时请以超链接或其它形式标明文章出处
@Doug Shume it's ok for me , you can post here.
Saved as a favorite, I like your website!
If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.
Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!
Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.
Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.
zh.us.to 有效
kms.03k.org 有效
kms.chinancce.com
kms.shuax.com 有效
kms.dwhd.org 有效
kms.luody.info 有效
kms.digiboy.ir 有效
kms.lotro.cc 有效
www.zgbs.cc 有效
cy2617.jios.org 有效
@ 权限问题,试试sudo 再加命令。
你好提示Permission denied 怎么办啊