forked from cirosantilli/linux-cheat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pstree.sh
32 lines (20 loc) · 909 Bytes
/
pstree.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# On Ubuntu, comes from the psmisc package.
# Shows tree of which process invocates which
pstree
# This works because in POSIX new processes are created exclusively
# by forking from other processes, and parent information is stored
# on each process, which dies if the parent dies
# this is a very insightfull program to understand what happened after
# the `init` process, first process on the system and common ancestor of all, started
# Particularaly interesting if you are on a graphical interface,
# to understand where each process comes from
# Quotint `man pstree`, multiple processes with same name and parent are wrttin in short notation:
#init-+-getty
# |-getty
# |-getty
# `-getty
# Becomes:
#init---4*[getty]
# Threads (run parallel, but on same data, and cannot fork) are indicated by brackets:
#icecast2---13*[{icecast2}]
# Means that `icecast2` has 13 threads.