↑ ↓ select, Enter open, Esc close

Query uptime, memory and restart count of a service

Adjust the values, the command updates live
user@server
systemctl show php8.2-fpm -p ActiveState,ActiveEnterTimestamp,MainPID,MemoryCurrent,NRestarts

Prints selected properties as Name=Value, ideal for scripts and monitoring. NRestarts counts how often systemd restarted the service because of Restart=; a rising value means repeated crashes. MemoryCurrent is the memory of the entire control group in bytes, including all child processes.

Note: MemoryCurrent shows [not set] if memory accounting is not active for the unit.

Also searched as

  • how often has the service crashed
  • since when is the service running
  • memory usage of a systemd service
  • count service restarts

Related one-liners

All in systemd

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.