Skip to content

service Linux command

The Linux service command is a powerful tool for managing services on a Linux system. It provides a simple and efficient way to start, stop, restart, enable, disable, and view the status of services. Services are background processes that run independently of the logged-in user, and the service command allows users to interact with these processes easily. By using the service command, users can ensure that critical services are running smoothly and troubleshoot any issues that may arise. This command is essential for system administrators and users who need to maintain the health and functionality of their Linux systems.

Terminal window
service [option] [parameter] [service_name]
OptionDescription
—status-allDisplay status of all services
—status-all-shortDisplay short status of all services
—status-all-jobsDisplay detailed status of all services
—helpDisplay help information
ParameterDescription
startStart the specified service
stopStop the specified service
restartRestart the specified service
reloadReload configuration of the specified service
statusDisplay status of the specified service
Terminal window
service apache2 start

Starts the Apache web server service.

Terminal window
service ssh stop

Stops the SSH service.

Terminal window
service nginx restart

Restarts the Nginx web server service.

Terminal window
service mysql status

Displays the status of the MySQL service.

Terminal window
service tomcat enable

Enables the Tomcat service to start automatically during system boot.

Terminal window
service postfix disable

Disables the Postfix mail service from starting automatically on system boot.

To start a service in Linux, use the following command:

Terminal window
service serviceName start

To stop a service in Linux, use the following command:

Terminal window
service serviceName stop

To restart a service in Linux, use the following command:

Terminal window
service serviceName restart

How do I check the status of a service in Linux?

Section titled “How do I check the status of a service in Linux?”

To check the status of a service in Linux, use the following command:

Terminal window
service serviceName status

How do I enable a service to start on boot in Linux?

Section titled “How do I enable a service to start on boot in Linux?”

To enable a service to start on boot in Linux, use the following command:

Terminal window
sudo systemctl enable serviceName

How do I disable a service from starting on boot in Linux?

Section titled “How do I disable a service from starting on boot in Linux?”

To disable a service from starting on boot in Linux, use the following command:

Terminal window
sudo systemctl disable serviceName

How do I reload configuration of a service in Linux?

Section titled “How do I reload configuration of a service in Linux?”

To reload the configuration of a service in Linux, use the following command:

Terminal window
service serviceName reload

To list all services in Linux, use the following command:

Terminal window
service --status-all
  • Start a service
  • Stop a service
  • Restart a service
  • Check the status of a service
  • Enable a service to start on boot
  • Disable a service from starting on boot