mkunit list

List units created by mkunit.

mkunit list [flags]

Description

The list command shows all units that were created by mkunit (or all units in the user/system directories). It displays the unit name, type, status, and whether it's enabled.

Flags

Flag Description Default
--system List system units false
--type <type>, -t Filter by unit type (service, timer, socket, path, mount, target) All types
--state <state> Filter by state (active, inactive, failed) All states
--all, -a Include all units, not just mkunit-created ones false
--json Output as JSON false

Examples

List all user units

mkunit list

Example output:

UNIT                    TYPE      STATE    ENABLED
myapp.service           service   active   yes
backup.service          service   inactive yes
backup.timer            timer     active   yes
file-watcher.path       path      active   yes

4 units

List only services

mkunit list -t service

List only running units

mkunit list --state active

List system units

mkunit list --system

List timers

mkunit list -t timer

For timers, additional columns show last run and next run times:

UNIT             STATE   LAST RUN            NEXT RUN
backup.timer     active  2024-01-15 00:00    2024-01-16 00:00
sync.timer       active  2024-01-15 14:45    2024-01-15 15:00

2 timers

JSON output

mkunit list --json
[
  {
    "name": "myapp.service",
    "type": "service",
    "state": "active",
    "enabled": true,
    "path": "/home/user/.config/systemd/user/myapp.service"
  },
  {
    "name": "backup.timer",
    "type": "timer",
    "state": "active",
    "enabled": true,
    "last_run": "2024-01-15T00:00:00Z",
    "next_run": "2024-01-16T00:00:00Z",
    "path": "/home/user/.config/systemd/user/backup.timer"
  }
]

List failed units

mkunit list --state failed

See Also