29 C
Jaipur
Sunday, October 18, 2020

How To List Startup Services At Boot In Linux

Must read

Samsung Galaxy S30 release date, price, news and leaks

The Samsung Galaxy S20 is the company's most premium and impressive smartphone to date, but already we’re dreaming of what Samsung will cook up...

Packers vs Buccaneers live stream: how to watch NFL week 6 online from anywhere now

This could be tasty. Amazingly, the 36-year-old Aaron Rodgers and 43-year-old Tom Brady have only ever faced each other twice before - in 2014...

Jets vs Dolphins live stream: how to watch NFL week 6 online from anywhere now

The Jets are going to Miami this weekend, where they'll be trying to wrestle their first win of the season from the 2-3 Dolphins....

7 Best Free Case Converter Online|Title Capitalization Tool In 2020

While it’s possible to change case of a couple of sentences manually, doing the same for long paragraphs can be burdensome. This is where...

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.
List all services in Linux with systemd

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

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:

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Samsung Galaxy S30 release date, price, news and leaks

The Samsung Galaxy S20 is the company's most premium and impressive smartphone to date, but already we’re dreaming of what Samsung will cook up...

Packers vs Buccaneers live stream: how to watch NFL week 6 online from anywhere now

This could be tasty. Amazingly, the 36-year-old Aaron Rodgers and 43-year-old Tom Brady have only ever faced each other twice before - in 2014...

Jets vs Dolphins live stream: how to watch NFL week 6 online from anywhere now

The Jets are going to Miami this weekend, where they'll be trying to wrestle their first win of the season from the 2-3 Dolphins....

7 Best Free Case Converter Online|Title Capitalization Tool In 2020

While it’s possible to change case of a couple of sentences manually, doing the same for long paragraphs can be burdensome. This is where...

Broncos vs Patriots live stream: how to watch NFL week 6 online from anywhere now

It started out as deja vu for the Pats, who had their second game in a row rescheduled because of Covid-19 - then it...