Services

Check services and act on the exact unit.

See service state, description and restart evidence; on systemd Linux, review and run a bounded action without leaving the terminal view.

Quick start

shell
lens-services
lens-services --once
lens-services --plain --service nginx
lens-services --json

Run without flags for the interactive list. Select a unit and press Enter to see its full name, load state, active state, sub-state, description and restart count when the service manager exposes one.

Reading service state

LoadWhether the service definition was found and loaded by the service manager.
ActiveThe broad lifecycle state, such as active, inactive or failed.
Sub-stateThe more specific current state, such as running, exited, dead or failed.
RestartsA restart counter where available. A rising count is stronger evidence than a single current-state sample.
DescriptionThe service manager's human-readable description, useful when the unit name is generated or unfamiliar.

An active (exited) one-shot unit is not necessarily broken, and an inactive unit is not necessarily expected to run. Lens shows the manager's state rather than guessing the intended policy for that machine.

Common investigations

A service is failed

shell
lens-services --service my-worker
lens-logs --service my-worker.service --since "30 minutes ago"

Confirm the exact unit and current state first, then inspect its recent journal messages. Restarting before reading the failure evidence can remove useful context or start a crash loop.

A service keeps restarting

Refresh the detail view and compare the restart counter. Use lens-top --filter-service to inspect its current processes and lens-logs --service for the repeated failure. Lens health also raises a restart-loop finding when the available evidence crosses its threshold.

You know part of the name, not the unit

Use / in the interactive list or --service TEXT for a focused snapshot. The target of an action must still be the complete exact unit name.

Interaction

/ j kMove through units
EnterInspect the selected service
aOpen the systemd action menu on Linux
/Search the service list
rRefresh service state
!Open a diagnostic shell beside the live view
EscReturn from detail or cancel an overlay
qQuit

Start, stop or reconfigure a systemd unit

On Linux, select a service and press a. Choose start, stop, restart, enable or disable. Lens then shows the exact unit and proposed operation in a separate confirmation screen. Press y to execute or Esc to go back.

The operation runs as the invoking user, has a 15-second deadline and is never retried automatically. Existing polkit, sudo and systemd policy decides whether it is authorised. Lens reads service state again after the command and refreshes the list.

shell
# Review a scriptable plan; no state change
lens-services --action restart --target nginx.service --dry-run

# Execute after explicit non-interactive confirmation
lens-services --action restart --target nginx.service --yes --json
Enable and start are different operations.

Enable changes boot-time configuration; it does not necessarily start the service now. Start affects the current runtime state. Choose the operation that matches the intended change.

Filters and output

--service NAMERestrict service collection to a matching name.
--filter TEXTCase-insensitive match across rendered service content.
--limit NUMBERMaximum rows; default 1,000, with 0 meaning unbounded.
--plainOne human-readable snapshot.
--jsonOne schema-v2 snapshot for scripts.

Structured service rows contain the exact unit name, load/active/sub state, description and optional restart count. Collection problems remain in collection_warnings.

Linux and macOS service managers

Linux

Lens reads systemd unit state and can run the five typed systemd actions above. Journald correlation and service/cgroup links are strongest on systemd systems.

macOS

Lens reads launchd labels, process identifiers, exit state and current activity for inspection. Use the diagnostic shell when a macOS investigation calls for a native launchctl command.

If service data is incomplete

A missing service manager, command timeout or permission failure appears in collection_warnings. Lens preserves any service rows it did collect. An empty service array accompanied by a warning means “unavailable,” not “this machine has no services.”