linux查看正在运行的线程,"linux ps -mH" 查看进程正在运行的线程

$ ps -mH

Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html

PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND

865 pts/0 0 6521 895 25732 6657 - 9196 - - - -bash

992 pts/0 0 2463 2500 1460591 365773 - 20208 - - - python worker.py 50

992 pts/0 0 1493 2500 1460591 365773 - 20208 - - - python worker.py 50

992 pts/0 0 143 2500 1460591 365773 - 20208 - - - python worker.py 50

992 pts/0 0 156 2500 1460591 365773 - 20208 - - - python worker.py 50

992 pts/0 0 60 2500 1460591 365773 - 20208 - - - python worker.py 50

992 pts/0 0 156 2500 1460591 365773 - 20208 - - - python worker.py 50

992 pts/0 0 139 2500 1460591 365773 - 20208 - - - python worker.py 50

......

1046 pts/3 0 445 71 17268 4335 - 1260 - - - top

1214 pts/2 0 6798 895 25740 6659 - 9208 - - - -bash

1335 pts/2 0 2382 2500 1214703 304301 - 19092 - - - python worker.py 20

1335 pts/2 0 146 2500 1214703 304301 - 19092 - - - python worker.py 20

1335 pts/2 0 161 2500 1214703 304301 - 19092 - - - python worker.py 20

1335 pts/2 0 145 2500 1214703 304301 - 19092 - - - python worker.py 20

1335 pts/2 0 143 2500 1214703 304301 - 19092 - - - python worker.py 20

1335 pts/2 0 144 2500 1214703 304301 - 19092 - - - python worker.py 20

1335 pts/2 0 144 2500 1214703 304301 - 19092 - - - python worker.py 20

......

1538 pts/4 0 7071 895 25732 6657 - 9212 - - - -bash

1677 pts/4 0 2731 2500 117355 29964 - 9784 - - - python task_scheduler.py

1968 pts/5 0 9404 895 25732 6657 - 9200 - - - -bash

2172 pts/1 0 2355 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 1506 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 138 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 124 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 127 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 158 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 149 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 153 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 150 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 145 2500 804667 201792 - 16804 - - - python worker.py

2172 pts/1 0 147 2500 804667 201792 - 16804 - - - python worker.py

2692 pts/5 0 337 94 8353 2112 - 1048 - - - ps -mH

27616 pts/1 0 16654 895 25740 6659 - 9220 - - - -bash

29612 pts/3 0 12869 895 25740 6659 - 9220 - - - -bash

【说明】

worker.py程序默认开10个线程,带一个参数,说明启动线程的个数。上面分别启动了

python worker.py 50

python worker.py 20

python worker.py

其中,有些参数为50和20的进程有些行省略了。

参考ps命令的帮助:

$ ps --help

********* simple selection ********* ********* selection by list *********

-A all processes -C by command name

-N negate selection -G by real group ID (supports names)

-a all w/ tty except session leaders -U by real user ID (supports names)

-d all except session leaders -g by session OR by effective group name

-e all processes -p by process ID

T all processes on this terminal -s processes in the sessions given

a all w/ tty, including other users -t by tty

g OBSOLETE -- DO NOT USE -u by effective user ID (supports names)

r only running processes U processes for specified users

x processes w/o controlling ttys t by tty

*********** output format ********** *********** long options ***********

-o,o user-defined -f full --Group --User --pid --cols --ppid

-j,j job control s signal --group --user --sid --rows --info

-O,O preloaded -o v virtual memory --cumulative --format --deselect

-l,l long u user-oriented --sort --tty --forest --version

-F extra full X registers --heading --no-heading --context

********* misc options *********

-V,V show version L list format codes f ASCII art forest

-m,m,-L,-T,H threads S children in sum -y change -l format

-M,Z security data c true command name -c scheduling class

-w,w wide output n numeric WCHAN,UID -H process hierarchy

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值