trees
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

git clone: git://bitreich.org/plstree 

*trees* is an collection of awk scripts to display trees, such as process trees
(pstree) or a directory tree (lstree).

For now, only pstree(1) and lstree(1) are implemented.


pstree
────────────────────────────────────────────────────────────────────────────────

It reads from the ps(1) command, so it is portable if there is POSIX awk(1) and
ps(1).  Busybox's ps is not fully POSIX but it still works.

│    USER     TTY        PID STAT  COMMAND
│    root     ??           1 Is    init
│    josuah   ??       90253 S     ├─ abduco
│    josuah   ttypb    77909 Ss+   │  └─ vis
│    josuah   ttypb     4072 S+p   │     └─ ksh
│    josuah   ttypb     6615 S+p   │        └─ awk
│    josuah   ttypb    61142 R+p/2 │           └─ ps
│    josuah   ttyp2    53904 I     ├─ enchive
│    josuah   ttyp8    48679 S     └─ runsvdir
│    josuah   ??       38166 Is       ├─ runsv
│    josuah   ??       74922 I        │  ├─ svlogd
│    josuah   ??       62834 Ip       │  └─ ssh-agent
│    josuah   ??       87618 Is       ├─ runsv
│    josuah   ??       10571 I        │  ├─ svlogd
│    josuah   ??       21319 S        │  └─ btpd
│    josuah   ??       18961 Is       ├─ runsv
│    josuah   ??       51149 I        │  ├─ svlogd
│    josuah   ??       59400 S        │  └─ qemu-system-x86_
│    josuah   ??       14126 Ss       └─ runsv
│    josuah   ??       99171 I           └─ svlogd

It have been tested with OpenBSD and busybox awk and ps.


lstree
────────────────────────────────────────────────────────────────────────────────

It reads from the find(1) and ls(1) commands and display it as a tree along
with the details from ls:

│   -rw-r--r--   1 josuah  wheel       50 Apr 13 08:39  ├─ .gitignore
│   -rw-r--r--   1 josuah  wheel      683 Apr 19 13:12  ├─ Makefile
│   drwxr-xr-x   2 josuah  wheel      512 Apr 19 01:59  ├─ bin
│   -rw-r--r--   1 josuah  wheel      142 Apr 19 00:18  │  ├─ agenda
│   -rwxr-xr-x   1 josuah  wheel      891 Apr 19 01:59  │  ├─ git
│   -rwxr-xr-x   1 josuah  wheel      111 Apr 19 01:00  │  ├─ html
│   -rwxr-xr-x   1 josuah  wheel      463 Apr 19 00:18  │  ├─ man
│   -rwxr-xr-x   1 josuah  wheel      235 Apr 19 00:19  │  ├─ page
│   -rwxr-xr-x   1 josuah  wheel      379 Apr 19 00:19  │  └─ stat
│   drwxr-xr-x   2 josuah  wheel      512 Apr 19 15:41  └─ code
│   -rw-r--r--   1 josuah  wheel     1062 Apr 19 01:35     ├─ iomenu.md
│   -rw-r--r--   1 josuah  wheel     2492 Apr 19 15:41     └─ trees.md

The parsing of ls is simple and mostly safe: to find the path name, it looks
for ' ./', which has no chance to occur ever on ls detail output.

It have been tested with OpenBSD and busybox awk and ps.


tree
────────────────────────────────────────────────────────────────────────────────

The *tree* script is also provided as an example for generating a tree from a
find-style list.

It reads a find-style text and convert it to a tree:

│   % find . │ ./tree