service

Linux · System · reference only

What it does

Starts, stops and queries services using the classic syntax. On systems with systemd it forwards the commands to systemctl.

Syntax

service servicio orden
service --status-all

Options and parameters

  • start

    Starts the service.

  • stop

    Stops the service.

  • restart

    Stops and starts the service again.

  • reload

    Asks the service to reread its configuration without stopping.

  • status

    Shows whether the service is running.

  • --status-all

    Lists all known services with their status.

Usage examples

  • sudo service ssh status

    Checks whether the SSH server is running.

  • sudo service nginx restart

    Restarts the nginx web server.

  • service --status-all

    Lists the services and marks the active ones.

  • sudo service apache2 stop

    Stops the Apache server.

Notes and common mistakes

  • On modern distributions systemctl is preferable, as it gives more information and control.
  • Service names are the scripts in /etc/init.d/ or the systemd units.

Related commands