-1

I found only one related question, but I don't feel the answer to that question helps me, the answers are too generic and broad.

I'm currently on and learning about Debian 11.3. How do I know which command to use in which case?

I don't know what other information I would need to include for this question. I'll update the question if needed.

  • One of the quoted code blocks in my answer is literally: case "${ACTION}" in restart|status) exec systemctl $sctl_args ${ACTION} ${UNIT} ;; i.e. systemctl restart ... is executed by service ... restart. – muru Apr 18 '22 at 18:24

1 Answers1

3

service ssh restart is a wrapper around systemctl restart ssh -- when you use the service command, it runs the systemctl command.

The service commands were written at a time when it was common for different distributions to have different ways of launching services (aka daemons). The service commands didn't care which way things were launched, and it created a uniform way of starting, stopping or restarting services. These days, most systems run systemd, which means that systemctl is available almost everywhere. It basically doesn't matter which one you use.