Command to list services that start on startup?

Is there a command to list services that run on startup? I imagine it would involve parsing /etc/init.d/, and the various /etc/rc.* directories.


The quick answer is: It depends on your init system.

The long answer is: For current versions of Ubuntu, you probably have a mix of Upstart, and SystemV. Newer versions of Ubuntu after 15.04 "Vivid Vervet" (and other Linux distros like RHEL/CentOS 7) are moving to use SystemD.

Upstart

  • Upstart Documentation

To list all services:

sudo initctl list

To list all Upstart services and run initctl show-config on them, this one-liner may be helpful:

sudo initctl list | awk '{ print $1 }' | xargs -n1 initctl show-config

System V

  • SysV Runlevels Documentation

To list all services:

sudo service --status-all

OR:

# for init scripts:
ls /etc/init.d/

# for runlevel symlinks:
ls /etc/rc*.d/

SystemD

  • SystemD for Upstart Users
  • FedoraProject SystemD Documentation
  • RHEL 7: Managing Services with SystemD
  • RedHat: SystemD Overview

To list all services:

sudo systemctl --all list-unit-files --type=service

OR:

ls /lib/systemd/system/*.service /etc/systemd/system/*.service

You can simply use the initctl list shell command to list the contents of /etc/init rather than the suggested dbus-send command.


The /etc/init.d and /etc/rc.* directories have been superseded by the 'upstart' init tool. Although scripts in these directories will be executed as expected, the new method for running things on init is defined by files in /etc/init/

You can list all of the upstart jobs with by querying upstart over dbus:

dbus-send --print-reply --system --dest=com.ubuntu.Upstart \
        /com/ubuntu/Upstart com.ubuntu.Upstart0_6.GetAllJobs

You may have to change 0_6 to reflect the version of upstart you have. This command works on my lucid install.


For Ubuntu 18.04 use :

systemctl list-units --type=service

instead of initctl.

Since Ubuntu 16.04, initctl has been replaced by systemd (source, in French).

If it can help @sanjay-manohar.


If you want a nice graphical representation of services and time it takes to boot try:

sudo apt install bootchart

For systemd (since 16.04) try systemd-bootchart instead:

sudo apt install systemd-bootchart