FreeKB - Linux Commands service command
Linux Commands - service command

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

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |