Cheat Sheet #day65 - service

Cloud TunedCloud Tuned
1 min read

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

  1. Start the Apache HTTP server:

     service apache2 start
    
  2. Stop the Apache HTTP server:

     service apache2 stop
    
  3. Restart the Apache HTTP server:

     service apache2 restart
    
  4. Check the status of the Apache HTTP server:

     service apache2 status
    
  5. 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.

0
Subscribe to my newsletter

Read articles from Cloud Tuned directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Cloud Tuned
Cloud Tuned