Linux services play a crucial role in the system’s functionality, and knowing which services start at boot can help in system administration, troubleshooting, and performance optimization. Services that start automatically at boot are usually managed by systemd, the default service manager in most modern Linux distributions.

In this guide, we will explore various methods to list all Linux services that are enabled to start at boot.

Method 1: Using systemctl to List Services at Boot

The systemctl command is part of the systemd service manager and is the most common way to list services that are enabled to start at boot.

systemctl list-unit-files --type=service --state=enabled

Output:

UNIT FILE                            STATE  
sshd.service                         enabled
apache2.service                      enabled
cron.service                         enabled
networking.service                   enabled

Method 2: Checking the Status of a Specific Service

To check whether a specific service is enabled to start at boot, use the systemctl is-enabled command.

systemctl is-enabled sshd

Output:

enabled

This confirms that the sshd service is enabled to start at boot. If the service is disabled, the output will be:

disabled

Method 3: Using systemctl list-dependencies for a Deeper View

The list-dependencies option in systemctl provides a hierarchical view of dependencies for systemd targets, including the services that start at boot under specific targets like multi-user.target (used for multi-user systems with networking).

systemctl list-dependencies multi-user.target

Output:

multi-user.target
● ├─apache2.service
● ├─cron.service
● ├─networking.service
● ├─sshd.service
● └─remote-fs.target

This shows that services like apache2, cron, networking, and sshd are dependencies of multi-user.target, meaning they start when the system enters this target (usually during boot).

Method 4: Listing Services by Boot Target

In systemd, services are organized under different targets that define specific system states. For example, multi-user.target is a common target for servers, and graphical.target is used on desktops with a GUI. You can list the services associated with a specific boot target.

systemctl list-dependencies graphical.target

Output:

graphical.target
● ├─gdm.service
● ├─cups.service
● ├─NetworkManager.service
● └─multi-user.target

Method 5: Using chkconfig for Older Linux Systems

On older Linux systems that use SysVinit instead of systemd, the chkconfig tool is used to manage and list services that start at boot.

chkconfig --list

Output:

sshd           0:off   1:off   2:on   3:on   4:on   5:on   6:off
httpd          0:off   1:off   2:on   3:on   4:on   5:on   6:off

Note: chkconfig is largely obsolete on modern Linux systems that use systemd, but it’s still useful on older systems.

Method 6: Viewing All Running Services

In addition to listing services that are enabled at boot, you might want to see all services that are currently running. Use the following systemctl command to display active services:

systemctl list-units --type=service --state=running

Output:

UNIT                  LOAD   ACTIVE SUB     DESCRIPTION
cron.service          loaded active running Regular background program processing daemon
sshd.service          loaded active running OpenSSH Daemon
apache2.service       loaded active running The Apache HTTP Server

Method 7: Using journalctl to Check Boot Services

You can use journalctl to examine the system boot logs and verify which services started during boot.

journalctl -b

This command will show detailed logs, including messages about which services started, their status, and any potential errors encountered during boot.

Conclusion

Knowing which services are enabled to start at boot is essential for Linux system administration, helping you manage system resources, optimize performance, and troubleshoot boot issues. With systemctl, you can easily list, enable, or disable services, providing fine-grained control over your system’s behavior at startup. Listing all Linux services starting at boot is straightforward on dedicated server hosting from Atlantic.Net!