service(8)
Run a System V init script or manage systemd services for system daemons.
Synopsis
service <service-name> <command> [options]Description
The service command is used to run System V init scripts located in /etc/init.d/ or, on systemd systems, to control systemd services. It provides a consistent interface for starting, stopping, and managing background services and daemons without needing to know the full path to init scripts.
On modern systemd-based distributions, service acts as a wrapper that translates commands to systemctl. On older init systems, it directly executes the init script with the given command.
Common options
| Flag | What it does |
|---|---|
--status-all | Show status of all services (uses init.d scripts) |
--help | Display help information |
Examples
Start the nginx web server service
service nginx startStop the MySQL database service
service mysql stopRestart the SSH daemon service
service sshd restartCheck the current status of Apache web server
service apache2 statusList status of all services managed by init.d
service --status-allReload PostgreSQL configuration without stopping the service
service postgresql reload