// Load the SysInfo package
load "SysInfo.ring"
// Create a new SysInfo instance
sys = new SysInfo
// Get basic system information
? "OS: " + sys.os()[:name]
? "Hostname: " + sys.hostname()
? "CPU: " + sys.cpu([])[:model]
? "Total RAM: " + (sys.ram()[:size] / 1024 / 1024) + " GB" // Note: RAM size is in KBFor more examples and detailed usage instructions, see the Usage Guide.
The SysInfo class provides the following public methods:
Retrieves the device model.
- Returns:
String- The device model (e.g., "Surface Pro 11").
Retrieves the system's hostname.
- Returns:
String- The hostname.
Retrieves the current logged-in user's name.
- Returns:
String- The username.
Retrieves operating system information.
- Returns:
List- A list containing::name(String): The pretty name of the OS (e.g., "Ubuntu 25.04").:id(String): The OS identifier (e.g., "ubuntu", "windows").
Retrieves the kernel version of the operating system.
- Returns:
String- The kernel version.
Retrieves detailed CPU information.
- Args:
params(List) - An optional list to specify additional information to retrieve.- Example:
[:usage = 1]to include CPU usage and temperature.
- Example:
- Returns:
List- A list containing::count(Number): Number of physical CPUs.:model(String): CPU model name.:cores(String): Total number of cores.:threads(String): Total number of threads.:usage(Number/Null): CPU usage percentage (Null if not available or[:usage = 1]was not passed).:temp(Number/Null): CPU temperature in Celsius (Null if not available, on VMs for some OSes, or[:usage = 1]was not passed).:cpus(List of Lists): Detailed information for each CPU (if available). Each sub-list contains::number(Number): CPU identifier.:model(String): Model name for this CPU.:cores(String): Cores for this CPU.:threads(String): Threads for this CPU.
Retrieves GPU information.
- Returns:
String- Name(s) of the GPU(s) or "No GPU detected!" or "Please install pciutils" (on Linux/FreeBSD iflspciis missing).
Retrieves information about the current shell.
- Returns:
List- A list containing::name(String): Name of the shell (e.g., "bash", "powershell").:version(String): Version of the shell.
Retrieves information about the current terminal emulator (Unix-like OSes only).
- Returns:
String- Terminal name and version (e.g., "xterm-256color") or "Unknown".
Retrieves RAM and Swap/Pagefile information. Values are in KB.
- Returns:
List- A list containing::size(Number): Total physical RAM.:used(Number): Used physical RAM.:free(Number): Free physical RAM.:swap(Number): Total Swap/Pagefile space.
Retrieves information about physical storage disks.
- Returns:
Listof Lists - Each sub-list represents a disk and contains::name(String): Disk model or name.:size(String): Disk size in KB.
Retrieves information about storage partitions/logical disks.
- Returns:
Listof Lists - Each sub-list represents a partition and contains::name(String): Partition name.:size(String): Partition size in KB.:used(String): Used space on the partition in KB.:free(String): Free space on the partition in KB.
Calculates and formats the system uptime.
- Args:
params(List) - An optional list to specify which time units to include.- Example:
[:days = 1, :hours = 1, :minutes = 1, :seconds = 1](default if empty list or no param passed) - To show only days and hours:
[:days = 1, :hours = 1]
- Example:
- Returns:
String- Formatted uptime string (e.g., "1 day, 2 hours, 30 minutes, 15 seconds").
Retrieves the system architecture.
- Returns:
String- System architecture (e.g., "amd64").
Retrieves information about installed packages/programs on the system.
- Returns:
List- A list containing::name(String): The name of the primary package manager detected (e.g., "dpkg" "brew").:count(Number): The total count of installed packages/programs.
Checks if the system is likely a virtual machine.
- Returns:
Number-1if a VM is detected,0otherwise.
Retrieves network interface information.
- Returns:
Listof Lists - Each sub-list represents a network interface and contains::name(String): Interface name/description.:ip(String): IP address of the interface.:status(String, optional): Status of the interface (e.g., "up").