service
Command Cheatsheet
The service
command in Unix-like systems is used to control services (daemons) that run in the background. It allows starting, stopping, restarting, and managing services with ease. Here’s a quick reference guide:
Basic Syntax
service SERVICE_NAME {start|stop|restart|status}
Common Options
Start a service:
service apache2 start
Stop a service:
service apache2 stop
Restart a service:
service apache2 restart
Check status of a service:
service apache2 status
Reload configuration of a service without restarting:
service apache2 reload
Examples
Start the Apache HTTP server:
service apache2 start
Stop the Apache HTTP server:
service apache2 stop
Restart the Apache HTTP server:
service apache2 restart
Check the status of the Apache HTTP server:
service apache2 status
Reload the configuration of the Apache HTTP server:
service apache2 reload
Additional Information
Help option:
service --help
View manual page for
service
:man service
The service
command simplifies the management of services on Unix-like systems, providing a straightforward way to start, stop, restart, and check the status of services. For more detailed information and additional options, refer to the man
page or use service --help
.