pstree-json
@readwithai - X - blog - machine-aided reading - 📖⚡️🖋️
An easily-installable command-line to output the process tree in machine readable format. Suitable for pasting into an LLM.
Warning. This is ai-generated and I cannot guarantee to not changing the options! If people use it I may freeze it but don't use it in automated scripts unless you are freezing.
Motivation
Do you ever get a feeling like "what is wrong with the world". It feels very odd that this tool does not exist, so I am creating it.
Having a tree in JSON format makes it a lot easier to do things like find a processes parents and child etc.
Using programmatic tools and grep to interact with a process tree particular useful when you have a lot of processes.
Installation
You can install pstree-json using pipx:
pipx install pstree-json
Usage
To list processes us pstree-json.
pstree-json $PID
You likely want to use a combination of gron or json-leaves (written by the author) together with grep to search what is going on with tress and jq to then extract desired information.
Attribution and prior work
This tool is a wrapper around the psutil library - but is useful from the shell.
You might like to use pgtree which combines pg with pstree to show a process tree. You can use pstree - but this did not show me enough information.
pgtree-tui provides a tui for interactive wit hthe process tree.
About me
I am @readwithai. I create tools for reading, research and agency sometimes using the markdown editor Obsidian.
I also create a stream of tools that are related to carrying out my work.
I write about lots of things - including tools like this - on X. My blog is more about reading and research and agency.
Metadata
Release files for pstree-json 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pstree_json-1.0.0.tar.gz | 3.9 kB | Without provenance | Details for pstree_json-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pstree_json-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pstree_json-1.0.0-py3-none-any.whl |
Total release size: 8.0 kB
Release files / pstree_json-1.0.0.tar.gz
| Download URL | pstree_json-1.0.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d57b548b5145acf468621b714e00fd0194c7e626cbd8932ad319accc13a75284
|
|
BLAKE2b-256 checksum How to use checksums |
7d4c7eea7a8b76f4d0dfa5532ebc175ed50bcf7d0f6be9ad04c58f6107da894f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / pstree_json-1.0.0-py3-none-any.whl
| Download URL | pstree_json-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bbf95ab5eee636d36097298903d5d8198f71adfad7d8d6bb1ddb4e21ae377da
|
|
BLAKE2b-256 checksum How to use checksums |
84a3f384e48ae5b1138233386bd08b7e93400052236e25cdc8032799e400c0f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for pstree-json 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.