Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akme/lsofgraph-python
python version of lsof to graphviz parser
https://github.com/akme/lsofgraph-python
dot graphviz linux lsof macos python unflatten
Last synced: about 2 months ago
JSON representation
python version of lsof to graphviz parser
- Host: GitHub
- URL: https://github.com/akme/lsofgraph-python
- Owner: akme
- License: mit
- Created: 2018-04-11T12:56:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-21T16:11:56.000Z (over 1 year ago)
- Last Synced: 2024-04-22T05:10:26.501Z (5 months ago)
- Topics: dot, graphviz, linux, lsof, macos, python, unflatten
- Language: Python
- Size: 130 KB
- Stars: 122
- Watchers: 7
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Python version of [zevv/lsofgraph](https://github.com/zevv/lsofgraph)
A small utility to convert Unix `lsof` output to a graph showing FIFO and UNIX interprocess communication.
Generate graph:
````shell
sudo lsof -n -F | python lsofgraph.py | dot -Tjpg > /tmp/a.jpg
OR
sudo lsof -n -F | python lsofgraph.py | dot -T svg > /tmp/a.svg
````
or add `unflatten` to the chain for a better layout:````shell
sudo lsof -n -F | python lsofgraph.py | unflatten -l 1 -c 6 | dot -T jpg > /tmp/a.jpg
OR
sudo lsof -n -F | python lsofgraph.py | unflatten -l 1 -c 6 | dot -T svg > /tmp/a.svg
````
Note: In cases of handling large datasets, you might encounter a "maximum recursion depth exceeded" error. To work around this, you can increase the recursion limit in your Python environment by adding `sys.setrecursionlimit(15000)` in the `lsofgraph.py` script.![example output](/example.jpg)
# Install and use on MacOS
Graphviz contains utilities dot and unflatten
````shell
brew install Graphviz
git clone https://github.com/akme/lsofgraph-python.git
cd lsofgraph-python
lsof -n -F | python lsofgraph.py | unflatten -l 1 -c 6 | dot -T jpg > /tmp/a.jpg && open /tmp/a.jpg
lsof -n -F | python lsofgraph.py | unflatten -l 1 -c 6 | dot -T svg > /tmp/a.jpg && open -a Safari.app '/tmp/a.svg'
````