Which command would you use to restart a service?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Prepare for the Red Hat Certified Architect Exam with our comprehensive quiz. Master your skills with multiple choice questions and detailed explanations. Gear up to excel!

The command to restart a service is "systemctl restart servicename.service." This command effectively stops the specified service if it is running and then starts it again. It ensures that any changes made to the service configuration take effect without requiring the administrator to manually stop and then start the service in two separate commands.

Using "systemctl start servicename.service" would only initiate the service if it is not currently running, but it wouldn't affect an already running service. On the other hand, the "service servicename restart" command is valid in older versions of service management, but "systemctl" is the preferred method in newer systems using systemd. The "systemctl stop servicename.service" command only halts the service without restarting it, which does not fulfill the requirement to restart the service. Therefore, the most appropriate command for restarting a service in a system using systemd is the specified one.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy