systemctl status Linux Command
Shows the current status, recent logs, and PID of a systemd service.
What does systemctl status do?
Shows the current status, recent logs, and PID of a systemd service.
Syntax
systemctl status service_namePractical example
systemctl status nginxQuestions about systemctl status
How do I check the status of a service?
Use `systemctl status service_name` to see if the service is active, inactive, failed, or in another state.
What does 'active (running)' mean in systemctl status?
It means the service is currently running normally. Other states include 'inactive' (stopped), 'failed' (error), and 'activating' (starting).
How do I see recent logs for a service?
Use `journalctl -u service_name -n 50` to see the last 50 log lines for a service. Add `-f` to follow logs in real time.
How do I see the PID of a service?
Use `systemctl status service_name` and look for the PID in the output. Use `systemctl show service_name -p MainPID` for just the PID.
How do I see all failed services?
Use `systemctl --failed` to list all services currently in a failed state. This is useful for quick system health checks.
How do I see service memory usage?
Use `systemctl show service_name -p MemoryCurrent` to see the current memory usage of a service in bytes.
How do I see how long a service has been running?
Use `systemctl status service_name` and look for 'Active:' line which shows the active state and duration.
How do I see all running services?
Use `systemctl list-units --type=service --state=running` to see all services that are currently running.
Related Service Commands
systemctl disableDisables a service from starting automatically at boot.
systemctl list-unitsLists all loaded and active systemd units (services, mounts, sockets, etc.).
systemctl enableEnables a service to start automatically at boot time.
serviceLegacy command to run SysV init scripts (works on both SysV and systemd).
systemctl restartStops and then starts a systemd service.
journalctlQueries and displays logs from the systemd journal.