---
# System prepended metadata

title: Linux - show running threads
tags: [linux]

---

# Linux - show running threads

###### tags: `linux`

```
htop
--------------------------------------------------------------------------------
press <F2>, choose "Setup" -> "Display option" -> goggle "Tree view" nad "Show custom thread names" -> press <F10>


top -H -p <pid>
--------------------------------------------------------------------------------
root@ycheng:~# top -H -p 28677

top - 13:51:58 up 36 days,  2:19, 13 users,  load average: 0.87, 0.58, 0.57
Threads:  13 total,   0 running,  13 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.8 us,  0.6 sy,  0.0 ni, 96.4 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  32625456 total, 23570312 used,  9055144 free,   288380 buffers
KiB Swap: 33229820 total,    21928 used, 33207892 free.  6178576 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
28677 ycheng    20   0  948428 211708  64708 S  0.0  0.6   1576:45 chrome
28682 ycheng    20   0  948428 211708  64708 S  0.0  0.6   1:32.37 Chrome_ChildIOT
28683 ycheng    20   0  948428 211708  64708 S  0.0  0.6   0:00.88 Compositor
28684 ycheng    30  10  948428 211708  64708 S  0.0  0.6   0:00.98 CompositorTileW  
28685 ycheng    30  10  948428 211708  64708 S  0.0  0.6   0:00.94 chrome
28686 ycheng    30  10  948428 211708  64708 S  0.0  0.6   0:00.94 CompositorTileW
28687 ycheng    30  10  948428 211708  64708 S  0.0  0.6   0:00.93 CompositorTileW
28688 ycheng    20   0  948428 211708  64708 S  0.0  0.6   0:00.00 handle-watcher-
28689 ycheng    20   0  948428 211708  64708 S  0.0  0.6   0:00.01 HTMLParserThrea
28695 ycheng    20   0  948428 211708  64708 S  0.0  0.6   0:00.02 ScriptStreamerT
30883 ycheng    20   0  948428 211708  64708 S  0.0  0.6   0:00.48 WorkerPool/92
 1284 ycheng    20   0  948428 211708  64708 S  0.0  0.6   0:00.37 WorkerPool/94
22320 ycheng    20   0  948428 211708  64708 S  0.0  0.6   0:00.04 WorkerPool/98


ps -e -T
 -e show all process
 -T list all threads
--------------------------------------------------------------------------------
root@ycheng:~# ps -e -T | grep 28677
28677 28677 ?        1-02:17:15 chrome
28677 28682 ?        00:01:32 Chrome_ChildIOT
28677 28683 ?        00:00:00 Compositor
28677 28684 ?        00:00:00 CompositorTileW
28677 28685 ?        00:00:00 chrome
28677 28686 ?        00:00:00 CompositorTileW
28677 28687 ?        00:00:00 CompositorTileW
28677 28688 ?        00:00:00 handle-watcher-
28677 28689 ?        00:00:00 HTMLParserThrea
28677 28695 ?        00:00:00 ScriptStreamerT
28677 30883 ?        00:00:00 WorkerPool/92
28677  1284 ?        00:00:00 WorkerPool/94
28677 22320 ?        00:00:00 WorkerPool/98


$ pstree -p <pid>
--------------------------------------------------------------------------------
root@ycheng:/tmp/data/2016/0616/1709# pstree -p 28677
chrome(28677)─┬─{chrome}(28682)
              ├─{chrome}(28683)
              ├─{chrome}(28684)
              ├─{chrome}(28685)
              ├─{chrome}(28686)
              ├─{chrome}(28687)
              ├─{chrome}(28688)
              ├─{chrome}(28689)
              ├─{chrome}(28695)
              ├─{chrome}(30883)
              ├─{chrome}(1284)
              └─{chrome}(22320)
```