#system-information #json-format #process-information #display #system-info #command-line-tool #collected

app sysinfojson

Command-line tool that displays system information collected using sysinfo crate in JSON format

1 unstable release

0.1.0 Sep 21, 2024

#398 in Operating systems

Download history 148/week @ 2024-09-17 30/week @ 2024-09-24 20/week @ 2024-10-01

198 downloads per month

MIT license

14KB
247 lines

sysinfojson

sysinfojson Actions Status License

Command-line tool that displays system information collected using sysinfo crate in JSON format.

// Install.
$ cargo install sysinfojson

// Print help.
$ sysinfojson -h
Command-line tool that displays system information collected using `sysinfo` crate in JSON format

Usage: sysinfojson <COMMAND>

Commands:
  system   Displays system information
  process  Displays process information
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

// Display system information (all).
$ sysinfojson system | jq . | head -10
{
  "cpu": {
    "cpus": [
      {
        "brand": "Apple M1 Max",
        "cpu_usage": 63.6363639831543,
        "frequency": 3228,
        "name": "1",
        "vendor_id": "Apple"
      },

// Display system information (memory only).
$ sysinfojson system memory | jq .
{
  "memory": {
    "available_memory": 38833061888,
    "total_memory": 68719476736,
    "total_swap": 0,
    "used_memory": 33337425920,
    "used_swap": 0
  }
}

// Display process information (PID: 1).
$ sysinfojson process 1 | jq .
{
  "cmd": [],
  "cpu_usage": 0,
  "cwd": null,
  "disk_usage": {
    "read_bytes": 0,
    "total_read_bytes": 0,
    "total_written_bytes": 0,
    "written_bytes": 0
  },
  "effective_group_id": null,
  "effective_user_id": null,
  "environ": [],
  "exe": "/sbin/launchd",
  "group_id": null,
  "memory": 0,
  "name": "launchd",
  "parent": null,
  "root": null,
  "run_time": 0,
  "session_id": 1,
  "start_time": 0,
  "status": "Unknown",
  "tasks": null,
  "thread_kind": null,
  "user_id": null,
  "virtual_memory": 0
}

Dependencies

~2.3–3.5MB
~67K SLoC