By default, some important system services are started automatically when the system boots. For instance, the NetworkManager and Firewalld services will be automatically started at system boot. The startup services are also known as daemons in Linux and Unix-like operating systems. They will keep running in the background and do their job without any user intervention. In addition to the system services, some other third-party applications will also add themselves to the startup. In this brief guide, let us see how to find and list startup services at boot time in Linux and Unix-like systems.
List Startup Services At Boot In Linux
Finding the list of startup services will differ depending upon the init
system. Systemd is the default init system for the major newer versions of Linux distributions.
If your systems runs with systemd
system manager, you can list all services with the following command:
$ sudo systemctl list-unit-files --type=service
Sample output:
UNIT FILE STATE VENDOR PRESET
accounts-daemon.service enabled enabled
acpid.service disabled enabled
alsa-restore.service static enabled
alsa-state.service static enabled
alsa-utils.service masked enabled
anacron.service enabled enabled
apparmor.service enabled enabled
apport-autoreport.service static enabled
[email protected] static enabled
apport.service generated enabled
.
.
.
[email protected] static enabled
whoopsie.service disabled enabled
[email protected] disabled enabled
[email protected] disabled enabled
wpa_supplicant.service enabled enabled
[email protected] disabled enabled
x11-common.service masked enabled
[email protected] static enabled
xfs_scrub_all.service static enabled
[email protected] static enabled
265 unit files listed.
As stated above, this command shows the list of all services (both enabled and disabled at system boot) in your Linux system. You can verify it by looking under the STATE section in the above output. The services that are started at boot are marked as enabled, and the services that are not started are marked as disabled.
To list only the enabled services at system boot, run:
$ sudo systemctl list-unit-files --type=service --state=enabled --all
Sample output:
UNIT FILE STATE VENDOR PRESET
accounts-daemon.service enabled enabled
anacron.service enabled enabled
apparmor.service enabled enabled
[email protected] enabled enabled
avahi-daemon.service enabled enabled
.
.
.
udisks2.service enabled enabled
ufw.service enabled enabled
unattended-upgrades.service enabled enabled
vboxweb.service enabled enabled
wpa_supplicant.service enabled enabled
74 unit files listed.
To list all disabled services at system boot, run:
$ sudo systemctl list-unit-files --type=service --state=disabled --all
Like I already said, some older Linux distributions may use either SysV or Upstart as their default init system.
If your system uses sysv
, run the following command to list all services:
$ sudo service --status-all
Sample output:
[ + ] acpid
[ - ] alsa-utils
[ - ] anacron
[ + ] apparmor
[ + ] apport
[ + ] avahi-daemon
[ + ] bluetooth
[ - ] console-setup.sh
[ + ] cron
[ - ] cryptdisks
[ - ] cryptdisks-early
[ + ] cups
[ + ] cups-browsed
[ + ] dbus
[ - ] dns-clean
[ + ] dnsmasq
[ + ] exim4
[ + ] gdm3
[ + ] grub-common
[ + ] hddtemp
[ - ] hwclock.sh
[ + ] irqbalance
[ + ] kerneloops
[ - ] keyboard-setup.sh
[ + ] kmod
[ + ] lm-sensors
[ - ] lvm2
[ - ] lvm2-lvmpolld
[ + ] network-manager
[ + ] networking
[ + ] openvpn
[ - ] plymouth
[ - ] plymouth-log
[ - ] pppd-dns
[ + ] procps
[ - ] pulseaudio-enable-autospawn
[ - ] rsync
[ + ] rsyslog
[ - ] saned
[ - ] screen-cleanup
[ + ] smartmontools
[ - ] speech-dispatcher
[ - ] spice-vdagent
[ + ] sysstat
[ + ] udev
[ + ] ufw
[ + ] unattended-upgrades
[ - ] uuidd
[ + ] virtualbox
[ - ] whoopsie
[ - ] x11-common
Here, the +
indicates the service is running, and -
indicates a stopped service. If you see ?
in the output, the service state cannot be determined (for some reason).
To list all services which are enabled at boot, run:
$ sudo chkconfig --list
This command will list status of each service on each run level. A sample output of the above command will be:
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
anamon 0:off 1:off 2:off 3:off 4:off 5:off 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
[...]
In the above command, "on" means the service is started at boot.
You can also view the status of a specific service at different run level like below:
$ sudo chkconfig --list httpd
If you Linux system uses upstart
, run this command to list all startup services:
$ sudo initctl list
The above command will show all Session jobs.
If you want to show all System jobs, run:
$ sudo initctl --system list
To list all services and show their statuses at each run level, run:
$ sudo initctl list | awk '{ print $1 }' | xargs -n1 initctl show-config
To show the state of a specific service, run this command:
$ initctl show-config <service_name>
Disable startup services in Linux
The more applications you install on your computer, the longer it takes for your system to boot. In order to improve your Linux system's boot time, you need to find the unnecessary services and disable them.
Say for example, if you don't want a service called unattended-upgrades.service
to load at startup, you can disable it using command:
$ sudo systemctl disable --now unattended-upgrades.service
To know if a service is enabled at boot time, run:
$ sudo systemctl is-enabled <service-name>
Related read:
1 comment
Very helpfull, thanks