ps命令实用方法.ps -l ps -L详解
c233 plugins # ps -elf|head -1
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
4 S root 28149 4204 0 80 0 - 16283 poll_s Jul05 ? 00:00:00 sshd: root
73
PROCESS FLAGS
The sum of these values is displayed in the "F" column, which is provided by the flags output specifier.
1 forked but didn't exec
4 used super-user privileges
(1)S列.
D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to complete)
T Stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z Defunct ("zombie") process, terminated but not reaped by its parent.
(3)C列.C pcpu cpu utilization
(4)
command COMMAND see args. (alias args, cmd).
sz SZ size in physical pages of the core image of the process. This
includes text, data, and stack space. Device mappings are currently
excluded; this is subject to change. See vsz and rss.
(5)WCHAN列.
wchan WCHAN name of the kernel function in which the process is sleeping,
a "-" if the process is running, or a "*" if the process is
multi-threaded and ps is not displaying threads.
二、统计当前运行的线程总数."-L"
c233 plugins # ps -eLf|grep -v $$|wc -l //-L Show threads, possibly with LWP and NLWP columns
646
c233 plugins # ps -eLf|grep -v $$|tail
UID PID PPID LWP C NLWP STIME TTY TIME CMD
root 1 689 0 36 Jul01 ? 00:00:06 /usr/sbin/nscd
root 1 690 0 36 Jul01 ? 00:00:06 /usr/sbin/nscd
root 4204 28149 0 1 Jul05 ? 00:00:00 sshd: root
NLWP (number of threads)
LWP (thread ID)
c233 plugins # ps -ef|grep nscd
root 23678 1 0 Jun30 ? 00:15:32 /usr/sbin/nscd
三、Linux下查看某个进程的线程数量.
1.根据进程号进行查询:
# pstree -p 进程号 //-p pid
# top -Hp 进程号 //-H : Threads toggle
2.根据进程名字进行查询:
# pstree -p `ps -e | grep sshd | awk '{print $1}'`
# pstree -p `ps -e | grep sshd | awk '{print $1}'` | wc -l
四、统计正在sleeop的线程总数.
d231 ~ # for i in `ps aux|awk '$8~/S/{print $2}'`;do //如何让其累加??如何查看正在运行的线程????
> m=`pstree -p $i|wc -l`
> echo $m
> done
No such user name: PID
0
1184
42
1
1
13
1
1
1
1
1
1
1
1
2
2
0
0
61
1
8
1
1088
1
ps命令实用方法.ps -l ps -L详解的更多相关文章
- ANDROID L——Material Design详解(UI控件)
转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! Android L: Google已经确认Android L就是Android Lolli ...
- [转]ANDROID L——Material Design详解(动画篇)
转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! 转自:http://blog.csdn.net/a396901990/article/de ...
- Java线程通讯方法之wait()、nofity() 详解
Java线程通讯方法之wait().nofity() 详解 本文将探讨以下问题: synchronized 代码块使用 notify()与notifyAll()的区别 Java wait(),noti ...
- 命令创建.net core3.0 web应用详解(超详细教程)
原文:命令创建.net core3.0 web应用详解(超详细教程) 你是不是曾经膜拜那些敲几行代码就可以创建项目的大神,学习了命令创建项目你也可以成为大神,其实命令创建项目很简单. 1.cmd命令行 ...
- UIViewController中各方法调用顺序及功能详解
UIViewController中各方法调用顺序及功能详解 UIViewController中loadView, viewDidLoad, viewWillUnload, viewDidUnload, ...
- jQuery插件开发的两种方法及$.fn.extend的详解(转)
jQuery插件开发的两种方法及$.fn.extend的详解 jQuery插件开发分为两种:1 类级别.2 对象级别,下面为大家详细介绍下 jQuery插件开发分为两种: 1 类级别 类级别你可以 ...
- 【转载】Linux命令-自动挂载文件/etc/fstab功能详解[转]
博客园 首页 新随笔 联系 订阅 管理 随笔 - 322 文章 - 0 评论 - 19 Linux命令-自动挂载文件/etc/fstab功能详解[转] 一./etc/fstab文件的作用 ...
- Windows命令(ping、telnet、netstat详解)
转至:https://www.cnblogs.com/lisuyun/articles/5864744.html netstat详解转自http://wsmajunfeng.iteye.com/blo ...
- JMeter学习-023-JMeter 命令行(非GUI)模式详解(一)-执行、输出结果及日志、简单分布执行脚本
前文 讲述了JMeter分布式运行脚本,以更好的达到预设的性能测试(并发)场景.同时,在前文的第一章节中也提到了 JMeter 命令行(非GUI)模式,那么此文就继续前文,针对 JMeter 的命令行 ...
随机推荐
- springmvc关于redisCluster的使用及配置
首先附上maven仓库jar包的下载地址:https://repo.spring.io/webapp/#/artifacts/browse/tree/General/libs-release-loca ...
- DirectoryEntry_Properties属性的遍历(win2003)
DirectoryEntry root = new DirectoryEntry(@"IIS://localhost/W3SVC"); string PInfo = "& ...
- Win2019 preview 版本的安装过程
1. 加入 windows insider 协议 登录自己的账号 同意 insder 协议. 然后 https://www.microsoft.com/en-us/software-download/ ...
- 常用的Hql语句
// HQL: Hibernate Query Language.// 特点:// >> 1,与SQL相似,SQL中的语法基本上都可以直接使用.// >> 2,SQL查询的是表 ...
- angular安装记录
1. 安装node.js,下载地址:https://nodejs.org/en/download/,详细的安装教程参考这里:https://blog.csdn.net/u010255310/artic ...
- std::string 字符串切割
在很多字符串类库里都实现了split函数.不过在std里没有实现.在这里拿出几个: 1. 用单字符作为分隔 #include <string> #include <vector> ...
- flask再学习-重构!启动!
1.打造MVC框架: common/libs:放置一些功能公用的方法. common/models:放置ORM模型 config:配置文件属性 web/controllers:视图层,处理url和ap ...
- Luogu2257 YY的GCD/BZOJ2818 Gcd加强版(莫比乌斯反演+线性筛)
一通套路之后得到 求出中间那个函数的前缀和的话就可以整除分块了. 暴力求的话复杂度其实很优秀了,大约在n~nlogn之间. 不过可以线性筛做到严格线性.考虑其最小质因子,如果是平方因子那么只有其有贡献 ...
- 洛谷 P4112 [HEOI2015]最短不公共子串 解题报告
P4112 [HEOI2015]最短不公共子串 题目描述 在虐各种最长公共子串.子序列的题虐的不耐烦了之后,你决定反其道而行之. 一个串的"子串"指的是它的连续的一段,例如bcd是 ...
- 《剑指offer》— JavaScript(27)字符串的排列
字符串的排列 题目描述 输入一个字符串,按字典序打印出该字符串中字符的所有排列.例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba. ...