Skip to content

System Information

import { lscpu } from '@sysopkit/linux/cpu';
import { getMemInfo } from '@sysopkit/linux/mem';
import { lsblk } from '@sysopkit/linux/disk';
import { getOSInfo } from '@sysopkit/linux/os';

Retrieves CPU architecture and topology information using lscpu --json.

const cpu = await lscpu();
// { cores: 8, modelName: '...', architecture: 'x86_64',
// vendor: 'GenuineIntel', sockets: 1, coresPerSocket: 8, threadsPerCore: 1 }

Retrieves current memory usage statistics from /proc/meminfo.

const mem = await getMemInfo();
// { total: 16441499648, available: 8234586112, used: 8206913536, free: 481914880 }

Retrieves block device information using lsblk --json.

const devices = await lsblk();
// returns BlockDeviceEntry[] with name, size, type, mountpoint, fstype, children

Retrieves operating system identification by parsing /etc/os-release.

const os = await getOSInfo();
// { name: 'Ubuntu 24.04 LTS', version: '24.04 LTS (Noble Numbat)',
// id: 'ubuntu', versionId: '24.04' }