systemctl enable Linux Command
Enables a service to start automatically at boot time.
What does systemctl enable do?
Enables a service to start automatically at boot time.
Syntax
systemctl enable service_namePractical example
sudo systemctl enable sshQuestions about systemctl enable
How do I enable a service at boot?
Use `sudo systemctl enable service_name` to configure the service to start automatically when the system boots.
What is the difference between enable and start?
`enable` configures auto-start at boot. `start` runs the service now. Use `enable --now` to do both at once.
How do I enable a service and start it now?
Use `sudo systemctl enable --now service_name` to enable at boot and start immediately in one command.
How do I disable a service from starting at boot?
Use `sudo systemctl disable service_name` to prevent the service from starting automatically at boot.
How do I check if a service is enabled?
Use `systemctl is-enabled service_name` to check. Returns 'enabled' or 'disabled'.
How do I list all enabled services?
Use `systemctl list-unit-files --type=service --state=enabled` to see all services configured to start at boot.
How do I enable a static service?
Static services cannot be enabled normally. They are started by other services or the system. Use `systemctl enable --force` if needed.
How do I mask a service completely?
Use `sudo systemctl mask service_name` to completely disable a service, preventing even manual starts. Use `unmask` to reverse.
Related Service Commands
systemctl restartStops and then starts a systemd service.
systemctl disableDisables a service from starting automatically at boot.
systemctl stopStops a running systemd service immediately.
systemctl statusShows the current status, recent logs, and PID of a systemd service.
systemctl startStarts a systemd service immediately.
systemctl list-unitsLists all loaded and active systemd units (services, mounts, sockets, etc.).