I can run following command on my Ubuntu 14.04.3 Terminal without any problem:
sudo service network-manager restart
[sudo] password for username:
network-manager stop/waiting
network-manager start/running, process 5204
If I type sudo service network
and then press Tab it is auto completed to sudo service networking
.
If I type sudo service network-ma
and them press Tab no auto-complete occurs.
My question is if there is a service named network-manager
that could be restarted by service
command why its name is not auto-completed? and How to solve it?
Update:
ls -l /etc/init.d/network*
-rwxr-xr-x 1 root root 4479 Apr 28 2014 /etc/init.d/networking
The tab completion for
service
looks foe files in/etc/init.d
. Since there is nonetwork-manager
file there, the tab completion fails. A better question is whyservice network-manager
works at all.According to the
service
man page:So, since there is a
/etc/init/network-manager.conf
file,service
can query it, but there is no autocompletion because there is no script of that name in/etc/init.d
.A simple workaround would be to create an empty file called
network-manager
in/etc/init.d
:Once you've done that, you can tab-complete the name as expected. I tested this in a VM and it seemed to work fine, the
service network-manager start|stop|restart|status
commands all worked and nothing seemed to be broken. I assume that means that the empty file is ignored and only used for the completion, so it looks like this is safe.