OS

In this section you will learn how to get information about the installed operating system, versions of installed development specific software packages, shell and users online:

For function reference and examples we assume, that we imported systeminformation as follows:

const si = require('systeminformation');

Operating System, Shell, Versions, Users

All functions in this section return a promise or can be called with a callback function (parameter cb in the function reference)

Function Result object Linux BSD Mac Win Sun Comments
si.osInfo(cb) {...} X X X X X OS information
platform X X X X X 'linux', 'darwin', 'win32', ...
distro X X X X X
release X X X X X
codename X
kernel X X X X X kernel release - same as os.release()
arch X X X X X same as os.arch()
hostname X X X X X same as os.hostname()
fqdn X X X X X fully qualfied domain name
codepage X X X X OS build version
logofile X X X X X e.g. 'apple', 'debian', 'fedora', ...
serial X X X X OS/Host serial number
build X X X OS build version
servicepack X service pack version
uefi X X X X OS uses UEFI on startup
hypervizor X hyper-v detected (win only)
remoteSession X runs in remote session (win only)
Example
const si = require('systeminformation');
si.osInfo().then(data => console.log(data));
{
  platform: 'darwin',
  distro: 'Mac OS X',
  release: '10.15.3',
  codename: 'macOS Catalina',
  kernel: '19.3.0',
  arch: 'x64',
  hostname: 'hostname.local',
  fqdn: 'hostname.local',
  codepage: 'UTF-8',
  logofile: 'apple',
  serial: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
  build: '19D76',
  servicepack: '',
  uefi: true
}
si.shell(cb) : string X X X X standard shell
si.versions(apps, cb) {...} X X X X X version information of
node and dev software packages
optional apps param (string,
comma or space seperated)
only those apps are detected
kernel X X X X X os kernel version
openssl X X X X X node openssl version
systemOpenssl X X X X X os openssl version
systemOpensslLib X X X X X openSSL, LibreSSL, ...
node X X X X X node version
v8 X X X X X v8 version
npm X X X X X npm version
yarn X X X X X yarn version
pm2 X X X X X pm2 version
gulp X X X X X gulp version
grunt X X X X X grunt version
git X X X X X git version
tsc X X X X X typescript version
mysql X X X X X mysql version
redis X X X X X redis version
mongodb X X X X X mongodb version
apache X X X X X apache version
nginx X X X X X nginx version
php X X X X X php version
docker X X X X X docker version
postfix X X X X X postfix version
postgresql X X X X X postgresql version
perl X X X X X perl version
python X X X X X python version
python3 X X X X X python3 version
java X X X X X java version
gcc X X X X X gcc version
virtualbox X X X X X virtualbox version
bash X X X X X bash version
zsh X X X X X zsh version
fish X X X X X fish version
powershell X powershell version
dotnet X dotnet version
Example
const si = require('systeminformation');
si.versions().then(data => console.log(data));
{
  kernel: '19.3.0',
  openssl: '1.1.1d',
  systemOpenssl: '2.8.3',
  systemOpensslLib: 'LibreSSL',
  node: '13.8.0',
  v8: '7.9.317.25-node.28',
  npm: '6.13.6',
  yarn: '',
  pm2: '',
  gulp: '',
  grunt: '',
  git: '2.21.1',
  tsc: '3.7.5',
  mysql: 'gpl)',
  redis: '',
  mongodb: '',
  apache: '2.4.41 (Unix)',
  nginx: '',
  php: '7.3.11',
  docker: '19.03.5',
  postfix: '3.2.2',
  postgresql: '12.1',
  perl: '5.18.4',
  python: '2.7.16',
  python3: '3.7.3',
  pip: '',
  pip3: '19.0.3',
  java: '',
  gcc: '4.2.1',
  virtualbox: '',
  bash: '3.2.57',
  zsh: '5.8',
  fish: '',
  powershell: '',
  dotnet: ''
}
Example 2
const si = require('systeminformation');
si.versions('npm, php, postgresql').then(data => console.log(data));
{
  npm: '6.13.6',
  php: '7.3.11',
  postgresql: '12.1'
}
si.users(cb) [{...}] X X X X X array of users online
[0].user X X X X X user name
[0].tty X X X X X terminal
[0].date X X X X X login date
[0].time X X X X X login time
[0].ip X X X X ip address (remote login)
[0].command X X X X last command or shell
Example
const si = require('systeminformation');
si.users().then(data => console.log(data));
[
  {
    user: 'yourname',
    tty: 'ttys006',
    date: '2020-02-01',
    time: '21:20',
    ip: '',
    command: 'w -ih'
  },
  {
    user: 'othername',
    tty: 'ttys008',
    date: '2020-02-01',
    time: '21:20',
    ip: '',
    command: '-bash'
  }
]