Uniformity Across Your Linux Platform


By: maggot62

January 14, 2009 12:42 pm





It has been traditional within SUSE that service scripts are activated with a symbolic link usually in /usr/sbin. So that to start the sshd service you can issue the command rcsshd start as root from anywhere as the /usr/sbin directory is in the search path. Of course you also would be able to use the syntax /etc/init.d/sshd start , but this has always been a little long winded ;(

Moreover, these symlinks are not available in RedHat or CENTOS. They have the standard command: service . The problem with the command service is that you have to know the service name. You cannot use tab completion. So let’s fix that!

 complete -W "$(ls /etc/init.d/)" service
  • complete : the command complete sets up tab completion
  • -W : this option creates a word list for completion
  • “$(ls /etc/init.d/)” : out word list is made up of the output of the command ls /etc/init.d/
  • service : this then sets up the configured completion for the command service

Test and enjoy!

If you want this all the time add it to your ~/.bashrc

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Categories: SUSE Linux Enterprise, SUSE Linux Enterprise Desktop, SUSE Linux Enterprise Server, Technical Solutions

Disclaimer: As with everything else in the SUSE Blog, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.