Bootstrap FreeKB - Linux Commands - service command
Linux Commands - service command

Updated:   |  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 Buy Me A Coffee



Comments


Add a Comment


Please enter ddc656 in the box below so that we can be sure you are a human.