4

In ubuntu we do simple:

service MyService restart
service MyService stop
...

So, the service command is good and simple. I need this simplicity: how to install service command on Debian?

PS: this is an analog question, but here I need a command, not an explanation.

Peter Krauss
  • 255
  • 1
  • 3
  • 17
  • in debian10, `service` is not available if you login with `su`, but if you login with `su -` or `sudo su` it will be available.. something about $PATH environment variable not being set correctly if only logging in with `su` – hanshenrik May 29 '19 at 20:51

1 Answers1

18

The service command is part of the sysvinit-utils package.

Install it with:

apt-get install sysvinit-utils

But most probably, it is already installed in /usr/sbin/service.

If it's missing in your $PATH, add this line to your ~/.bashrc:

PATH=$PATH:/usr/sbin
chaos
  • 47,463
  • 11
  • 118
  • 144
  • 1
    Yes, `/usr/sbin/service` at Debian Stable (!), thanks... Well, how to get all *sbin* aliases? [is it?](http://unix.stackexchange.com/a/10727/130402) – Peter Krauss Aug 28 '15 at 13:54
  • @PeterKrauss Yes, add them to you `$PATH` variable – chaos Aug 28 '15 at 13:56
  • @chaos important step : after updating .bashrc you need to logout and login back to terminal or just reload bashr using command `source ~/.bashrc` – user889030 Jun 08 '20 at 14:56