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
- Host: GitHub
- URL: https://github.com/joknarf/pgtreeawk
- Owner: joknarf
- License: mit
- Created: 2020-08-31T20:06:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-01T21:58:40.000Z (over 5 years ago)
- Last Synced: 2025-01-07T15:43:03.099Z (about 1 year ago)
- Language: Shell
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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`

show processes matching `bash` and their children

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

## Demo
