Linux and Command-Line Basics

On a Linux system using systemd, which of the following is the difference between "systemctl start license.service" and "systemctl enable license.service" for the service license.service?

  1. Astart makes the service run automatically from the next boot of the computer, and enable starts the service right now
  2. Bstart starts the service right now, and enable sets it to start automatically when the computer boots
  3. Cstart runs the service as one only root can use, and enable allows ordinary users to operate the service too
Show answer and explanation

Answer: B. start starts the service right now, and enable sets it to start automatically when the computer boots

systemctl start starts the service right now, but the started state does not persist after a reboot. systemctl enable sets the service to be started automatically when the system boots, and enable alone does not start it now. To do both at once, use systemctl enable --now; stop stops it and disable removes the automatic start. Whether the service is running, and its recent log, can be checked with systemctl status.

  • A. The roles of start and enable are reversed. start starts it immediately, and enable sets up automatic start at boot.
  • B. Correct. start starts it now, and enable sets up automatic start at boot.
  • C. start and enable do not decide who can operate the service.
Practice this topic Back to topic

Books on Linux and Command-Line Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Linux and Command-Line Basics questions

  1. The line "30 2 * * 1 /home/alice/backup.sh" was registered in cron. Which of the following is when backup.sh is run?
  2. A Linux server warns that disk space is running low. Which of the following is the correct pair of a command to check usage and free space for each file system and a command to total the space used by the files in a directory?
  3. You created a public-key authentication key pair with ssh-keygen on your own PC and want to connect to the server server1 with ssh without a password. Which of the following is the correct way to place the keys?
  4. Which of the following is what happens when "tar -czf proj.tar.gz proj/" is run?
  5. After editing main.c, a file managed with Git, only git commit -m "fix" was run, and "no changes added to commit" was shown and nothing was committed. Which of the following is the reason?