Skip to content
jc-rs
GitHub

systemctl-ls

--systemctl-lsv1.5.0

Converts `systemctl list-sockets` command output to JSON

Linuxcommand
$ systemctl list-sockets | jc-rs --systemctl-ls

A real pair

From the reference corpus (centos-7.7/systemctl-ls.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. CI compares jc-rs with it field by field under the published differential. Hover a value to see where it came from.

systemctl list-socketscentos-7.7
LISTEN                      UNIT                         ACTIVATES
/dev/log                    systemd-journald.socket      systemd-journald.service
/run/dbus/system_bus_socket dbus.socket                  dbus.service
/run/dmeventd-client        dm-event.socket              dm-event.service
/run/dmeventd-server        dm-event.socket              dm-event.service
/run/lvm/lvmetad.socket     lvm2-lvmetad.socket          lvm2-lvmetad.service
/run/lvm/lvmpolld.socket    lvm2-lvmpolld.socket         lvm2-lvmpolld.service
/run/systemd/initctl/fifo   systemd-initctl.socket       systemd-initctl.service
/run/systemd/journal/socket systemd-journald.socket      systemd-journald.service
/run/systemd/journal/stdout systemd-journald.socket      systemd-journald.service
/run/systemd/journal/syslog syslog.socket                syslog.service
/run/systemd/shutdownd      systemd-shutdownd.socket     systemd-shutdownd.service
/run/udev/control           systemd-udevd-control.socket systemd-udevd.service
[::]:22                     sshd.socket                 
kobject-uevent 1            systemd-udevd-kernel.socket  systemd-udevd.service

14 sockets listed.
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
[
  {
    "listen": "/dev/log",
    "unit": "systemd-journald.socket",
    "activates": "systemd-journald.service"
  },
  {
    "listen": "/run/dbus/system_bus_socket",
    "unit": "dbus.socket",
    "activates": "dbus.service"
  },
  {
    "listen": "/run/dmeventd-client",
    "unit": "dm-event.socket",
    "activates": "dm-event.service"
  },
  {
    "listen": "/run/dmeventd-server",
    "unit": "dm-event.socket",
    "activates": "dm-event.service"
  },
  {
    "listen": "/run/lvm/lvmetad.socket",
    "unit": "lvm2-lvmetad.socket",
    "activates": "lvm2-lvmetad.service"
  },
  {
    "listen": "/run/lvm/lvmpolld.socket",
    "unit": "lvm2-lvmpolld.socket",
    "activates": "lvm2-lvmpolld.service"
  },
  {
    "listen": "/run/systemd/initctl/fifo",
    "unit": "systemd-initctl.socket",
    "activates": "systemd-initctl.service"
  },
  {
    "listen": "/run/systemd/journal/socket",
    "unit": "systemd-journald.socket",
    "activates": "systemd-journald.service"
  },
  {
    "listen": "/run/systemd/journal/stdout",
    "unit": "systemd-journald.socket",
    "activates": "systemd-journald.service"
  },
  {
    "listen": "/run/systemd/journal/syslog",
    "unit": "syslog.socket",
    "activates": "syslog.service"
  },
  {
    "listen": "/run/systemd/shutdownd",
    "unit": "systemd-shutdownd.socket",
    "activates": "systemd-shutdownd.service"
  },
  {
    "listen": "/run/udev/control",
    "unit": "systemd-udevd-control.socket",
    "activates": "systemd-udevd.service"
  },
  {
    "listen": "[::]:22",
    "unit": "sshd.socket"
  },
  {
    "listen": "kobject-uevent 1",
    "unit": "systemd-udevd-kernel.socket",
    "activates": "systemd-udevd.service"
  }
]

Fixture coverage

2/2oracle-valid pairs match under the published structural JSON comparison

Magic syntax

jc-rs systemctl list-socketsjc-rs runs the command itself and parses what it prints. Recognised for: `systemctl list-sockets`

Source: crates/jc-rs-parsers/src/system/systemctl_ls.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare