Manage Linux services on the command line (Ubuntu)
Ubuntu 18.04 uses
systemd to manage services.
See which Services are running
To get an overview which services are available and running / not running, you can use
>service --status-all [ + ] acpid [ - ] alsa-utils [ - ] anacron [ + ] apache-htcacheclean [ - ] apache2 [ + ] apparmor [ + ] apport [ + ] avahi-daemon [ + ] avahi-dnsconfd [ - ] bluetooth [ - ] bootmisc.sh [ - ] brltty ...
+ means running,
- means not running,
? means unknown
To temporarily start or stop an service, you can use either
service <name> startor
systemctl start <name>
service <name> stopor
systemctl stop <name>
To prevent a service from being started e.g. on boot, you have to disable it. Likewise, if you want a service to be started on boot, you have to enable it:
systemctl enable <name>
systemctl disable <name>
If you disable a running service, it will not be stopped. It will just not be started on the next boot. So if you want to stop a service now and disable it, you have to do both steps:
>service --status-all | grep bluetooth [ + ] bluetooth >sudo service bluetooth stop >service --status-all | grep bluetooth [ - ] bluetooth >sudo systemctl disable bluetooth Synchronizing state of bluetooth.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install disable bluetooth insserv: warning: current start runlevel(s) (empty) of script `bluetooth' overrides LSB defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `bluetooth' overrides LSB defaults (0 1 6). Removed /etc/systemd/system/dbus-org.bluez.service.