psutil
Cross-platform lib for process and system monitoring in Python
What is psutil?
Cross-platform lib for process and system monitoring in Python
Overview of psutil
What it is
psutil is a cross-platform library for retrieving information about running processes and system utilization (CPU, memory, disks, network, sensors) in Python. It implements many functionalities offered by UNIX command line tools such as ps, top, free, iotop, netstat, ifconfig, lsof and others. It supports Linux, Windows, macOS, FreeBSD, OpenBSD, NetBSD, Sun Solaris, and AIX.
Key features
- Retrieve CPU metrics: percent usage per CPU, logical/physical core count, frequency
- Memory information: physical and swap memory usage, available, used, free
- Disk statistics: partitions, usage per mount point, I/O counters
- Network monitoring: I/O counters per interface, active TCP/UDP connections
- Sensor data: temperatures, battery status
- Process management: list running processes, get process details (name, exe, CPU, memory, open files, network connections)
Use cases
- System monitoring and profiling
- Limiting process resources
- Managing running processes
- Replacing shell commands like ps, top, free, iotop, netstat, ifconfig, lsof in Python scripts
Getting started
pip install psutil
For platform-specific details see the repository README.
License and pricing
Licensed under BSD-3-Clause. Open source and free.
Based on the project's public README and repository metadata.