An open API service indexing awesome lists of open source software.

https://github.com/joknarf/pgtreeawk

Unix process tree hierachy for specific processes with awk
https://github.com/joknarf/pgtreeawk

Last synced: 11 months ago
JSON representation

Unix process tree hierachy for specific processes with awk

Awesome Lists containing this project

README

          

# pgtreeawk
Unix process hierachy tree display for specific processes (kind of mixed pgrep + pstree)

awk version of [pgtree](https://github.com/joknarf/pgtree)

pgtree is also able to send signal to found processes and all their children

Should work on any Unix that can execute :
```
# /usr/bin/pgrep
# /usr/bin/ps -e -o pid,ppid,user,comm,args
```
## Usage
```
# pgtree -h
usage: pgtree [-ICya] [-c|-k|-K] [-p ,...|]

-I : use -o uid instead of -o user for ps command
(if uid/user mapping is broken ps command can be stuck)
-c : display processes and children only
-k : kill -TERM processes and children
-K : kill -KILL processes and children
-y : do not ask for confirmation to kill
-C : no color (default colored output on tty)
-a : use ascii characters

by default display full process hierarchy (parents + children of selected processes)

-p : select processes pids to display hierarchy (default 1)
: use pgrep to select processes (see pgrep -h)

found pids are prefixed with ▶
```
## Examples
show all parents and children of processes matching `bash`

# pgtree bash

show processes matching `bash` and their children

# pgtree -c bash

kill all `sh` processes of user joknarf and their children

#pgtree -k -u joknarf -x sh

## Demo

output