https://github.com/nlevitt/psutilz
utilities built on the psutil library
https://github.com/nlevitt/psutilz
Last synced: 10 months ago
JSON representation
utilities built on the psutil library
- Host: GitHub
- URL: https://github.com/nlevitt/psutilz
- Owner: nlevitt
- Created: 2020-02-04T07:47:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-16T18:27:15.000Z (over 2 years ago)
- Last Synced: 2025-02-05T03:57:11.253Z (11 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# psutilz
Utilities built on the psutil library
## pslisten
Prints information about processes listening on ports (TCP and UDP, IPv4 and IPv6).
```
$ sudo pslisten
PROTO HOST PORT USER PID PPID NIC %CPU %MEM #TH STARTED COMMAND
UDP4 0.0.0.0 137 _netbios 60612 1 20 0.0 0.0 2 2022-12-08 03:03:43 /usr/sbin/netbiosd
UDP4 0.0.0.0 137 root 1 0 0 0.0 0.0 3 2022-12-01 00:00:50 /sbin/launchd
UDP4 0.0.0.0 138 _netbios 60612 1 20 0.0 0.0 2 2022-12-08 03:03:43 /usr/sbin/netbiosd
UDP4 0.0.0.0 138 root 1 0 0 0.0 0.0 3 2022-12-01 00:00:50 /sbin/launchd
TCP4 127.0.0.1 631 root 70386 1 0 0.0 0.0 3 2022-12-07 10:20:28 /usr/sbin/cupsd -l
TCP6 ::1 631 root 70386 1 0 0.0 0.0 3 2022-12-07 10:20:28 /usr/sbin/cupsd -l
UDP4 0.0.0.0 5353 _mdnsresponder 300 1 0 0.0 0.0 3 2022-12-01 00:00:55 /usr/sbin/mDNSResponder
UDP6 :: 5353 _mdnsresponder 300 1 0 0.0 0.0 3 2022-12-01 00:00:55 /usr/sbin/mDNSResponder
```
## dstat
A fork of https://github.com/dstat-real/dstat

## ps.py
Like `ps -fHe` on linux, but portable to the extent that `psutil` is. Works on macOS at least.
```
$ ps.py | head
USER PID PPID NIC %CPU %MEM #TH STARTED COMMAND
root 0 ? ? ? ? ? 2023-02-10 07:21:25 kernel_task
root 1 ? ? ? ? ? 2023-02-10 07:21:25 launchd
root 299 1 ? ? ? ? 2023-02-10 07:21:49 logd
root 301 1 ? ? ? ? 2023-02-10 07:21:49 UserEventAgent
root 303 1 ? ? ? ? 2023-02-10 07:21:49 uninstalld
root 304 1 ? ? ? ? 2023-02-10 07:21:49 fseventsd
root 307 1 ? ? ? ? 2023-02-10 07:21:49 systemstats
root 748 307 ? ? ? ? 2023-02-10 07:22:05 systemstats
root 309 1 ? ? ? ? 2023-02-10 07:21:49 configd
Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
$ sudo ps.py | head
USER PID PPID NIC %CPU %MEM #TH STARTED COMMAND
root 0 ? ? 0.0 0.0 574 2023-02-10 07:21:25 kernel_task
root 1 ? ? 0.0 0.1 6 2023-02-10 07:21:25 /sbin/launchd
root 299 1 ? 0.0 0.1 4 2023-02-10 07:21:49 /usr/libexec/logd
root 301 1 ? 0.0 0.0 4 2023-02-10 07:21:49 /usr/libexec/UserEventAgent (System)
root 303 1 ? 0.0 0.0 2 2023-02-10 07:21:49 /System/Library/PrivateFrameworks/Uninstall.framework/Resources/uninstalld
root 304 1 ? 0.0 0.0 13 2023-02-10 07:21:49 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/Support/fseventsd
root 307 1 ? 0.0 0.1 3 2023-02-10 07:21:49 /usr/sbin/systemstats --daemon
root 748 307 ? 0.0 0.0 3 2023-02-10 07:22:05 /usr/sbin/systemstats --logger-helper /private/var/db/systemstats
root 309 1 ? 0.0 0.0 7 2023-02-10 07:21:49 /usr/libexec/configd
Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
```