A .NET 9 console application designed to retrieve and display hardware information from your system using
LibreHardwareMonitorLib. The output is provided in JSON format, making it easy to parse and integrate with other tools
or scripts.
- Cross-Platform: Built with .NET 9, aiming for compatibility with Windows, Linux, and macOS.
- Windows: Fullest support for hardware detection.
- Linux: Good support, may require elevated privileges for full data access.
- macOS: Limited hardware data due to OS restrictions on direct hardware access.
- Comprehensive Data: Gathers information on:
- CPU (Overall and Per-Core: Name, Load, Temperature, Clocks, Power)
- GPU (Name, Load, Temperature, Clocks, Memory Usage, Power)
- Memory (RAM Usage, Available Memory)
- Motherboard (Name, various sensors if available)
- Storage (Name, Temperature, Used Space - detection can be system-dependent)
- Network Adapters (Name, Data Sent/Received - detection can be system-dependent)
- Flexible Output Control:
- One-Time Report: Get a snapshot of current hardware status.
- Timed Reporting: Continuously output hardware status at user-defined intervals (in milliseconds).
- Component Filtering: Specify which hardware components to include in the report (e.g., only CPU and GPU).
- JSON Output: Clean, structured JSON output for easy programmatic use.
- .NET 9.0 SDK or Runtime:
- To build the project, you need the .NET 9.0 SDK.
- To run the compiled executable, users need the .NET 9.0 Runtime installed on their system.
- Download from dotnet.microsoft.com
- Clone the repository (or download the source files):
git clone https://github.com/KindaBrazy/LynxHardwareCLI cd LynxHardwareCLI - Restore dependencies:
dotnet restore LynxHardwareCLI.csproj
- Build the project:
The executable will be located in
dotnet build LynxHardwareCLI.csproj -c Release
bin/Release/net9.0/LynxHardwareCLI.exe(Windows) orbin/Release/net9.0/LynxHardwareCLI(Linux/macOS).
Navigate to the directory containing the executable.
Usage:
LynxHardwareCLI.exe [--mode \<once|timed\>] [--interval \<milliseconds\>] [--components \<list\>]
Arguments:
--mode <once|timed>:once: (Default) Outputs the hardware information once and exits.timed: Outputs hardware information repeatedly at the specified interval.
--interval <milliseconds>:- Specifies the update interval in milliseconds for
timedmode. - Defaults to
1000milliseconds (1 second). - Minimum recommended interval is
50milliseconds.
- Specifies the update interval in milliseconds for
--components <list>:- A comma or semicolon-separated list of components to include.
- Valid components:
cpu,gpu,memory,motherboard,storage,network,all. - Defaults to
all.
Examples:
-
Get all hardware information once:
./LynxHardwareCLI # or on Windows: LynxHardwareCLI.exe -
Get CPU and GPU information every 500 milliseconds:
./LynxHardwareCLI --mode timed --interval 500 --components cpu,gpu
-
Get Memory and Storage information once:
./LynxHardwareCLI --components memory,storage
-
Get all hardware information every 2 seconds (2000 milliseconds):
./LynxHardwareCLI --mode timed --interval 2000
Note on Permissions:
On Linux, you might need to run the application with sudo for full access to hardware sensors, especially for storage
and network details:
sudo ./LynxHardwareCLI --components allOn Windows, running as Administrator might provide more detailed information in some cases.
- macOS Limitations: Due to strict macOS restrictions on direct hardware access, the amount of data retrieved on macOS will be significantly less than on Windows or Linux. Many sensors may not be available.
- Virtual Machines: Hardware information reported within a VM might be limited or reflect the virtualized hardware rather than the host's physical hardware.
Contributions are welcome! If you'd like to contribute, please feel free to fork the repository, make your changes, and submit a pull request.