README - plstree - ps and ls displayed as a tree
(HTM) git clone git://bitreich.org/plstree git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/plstree
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
README (2995B)
---
1 trees
2 ================================================================================
3
4 *plstree* is an collection of awk scripts to display trees, such as process
5 trees (pstree) or a directory tree (lstree).
6
7
8 pstree
9 --------------------------------------------------------------------------------
10
11 It reads from the ps(1) command, so it is portable if there is POSIX awk(1) and
12 ps(1). Busybox's ps is not fully POSIX but it still works.
13
14 USER TTY PID STAT COMMAND
15 root ?? 1 Is init
16 josuah ?? 90253 S ├─ abduco
17 josuah ttypb 77909 Ss+ │ └─ vis
18 josuah ttypb 4072 S+p │ └─ ksh
19 josuah ttypb 6615 S+p │ └─ awk
20 josuah ttypb 61142 R+p/2 │ └─ ps
21 josuah ttyp2 53904 I ├─ enchive
22 josuah ttyp8 48679 S └─ runsvdir
23 josuah ?? 38166 Is ├─ runsv
24 josuah ?? 74922 I │ ├─ svlogd
25 josuah ?? 62834 Ip │ └─ ssh-agent
26 josuah ?? 87618 Is ├─ runsv
27 josuah ?? 10571 I │ ├─ svlogd
28 josuah ?? 21319 S │ └─ btpd
29 josuah ?? 18961 Is ├─ runsv
30 josuah ?? 51149 I │ ├─ svlogd
31 josuah ?? 59400 S │ └─ qemu-system-x86_
32 josuah ?? 14126 Ss └─ runsv
33 josuah ?? 99171 I └─ svlogd
34
35 It have been tested with OpenBSD and busybox awk and ps.
36
37
38 lstree
39 --------------------------------------------------------------------------------
40
41 It reads from the find(1) and ls(1) commands and display it as a tree along
42 with the details from ls:
43
44 -rw-r--r-- 1 josuah wheel 50 Apr 13 08:39 ├─ .gitignore
45 -rw-r--r-- 1 josuah wheel 683 Apr 19 13:12 ├─ Makefile
46 drwxr-xr-x 2 josuah wheel 512 Apr 19 01:59 ├─ bin
47 -rw-r--r-- 1 josuah wheel 142 Apr 19 00:18 │ ├─ agenda
48 -rwxr-xr-x 1 josuah wheel 891 Apr 19 01:59 │ ├─ git
49 -rwxr-xr-x 1 josuah wheel 111 Apr 19 01:00 │ ├─ html
50 -rwxr-xr-x 1 josuah wheel 463 Apr 19 00:18 │ ├─ man
51 -rwxr-xr-x 1 josuah wheel 235 Apr 19 00:19 │ ├─ page
52 -rwxr-xr-x 1 josuah wheel 379 Apr 19 00:19 │ └─ stat
53 drwxr-xr-x 2 josuah wheel 512 Apr 19 15:41 └─ code
54 -rw-r--r-- 1 josuah wheel 1062 Apr 19 01:35 ├─ iomenu.md
55 -rw-r--r-- 1 josuah wheel 2492 Apr 19 15:41 └─ trees.md
56
57 The parsing of ls is simple and mostly safe: to find the path name, it looks
58 for ' ./', which has no chance to occur ever on ls detail output.
59
60 It have been tested with OpenBSD and busybox awk and ps.
61
62
63 tree
64 --------------------------------------------------------------------------------
65
66 The *tree* script is also provided as an example for generating a tree from a
67 find-style list.
68
69 It reads a find-style text and convert it to a tree:
70
71 % find . │ ./tree