Linux Commands - service command
                
            
            
            
             
            
            
                           
                
            
            
            
                
    
    
     
            
                
                    by
                    Jeremy Canfield  |  
                    Updated: March 30 2020
                    
                          |  Linux Commands articles
                    
                    
                    
                
            
            The service command is used to start, stop, enable, disable, and check the status of a init service.
IMPORTANT
The service command is used by systems using init. systemctl is used by systems using systemd.
The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command.
UID         PID   PPID  C STIME TTY          TIME CMD
root          1      0  0 Mar08 ?        00:00:01 /sbin/init
If PID 1 is systemd, then you will use the systemctl command.
ps -ef | head
UID         PID   PPID  C STIME TTY          TIME CMD
root          1      0  0 Mar01 ?        00:06:47 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
service status
The service status command will show if a service is running or stopped.
service example.service status
service start
The service start command is used to start a service.
service example.service start
service stop
The service stop command is used to start a service.
service example.service stop
Did you find this article helpful?
If so, consider buying me a coffee over at 