RC service alias

Thu, 8 Jan. 2009     Thomas Bendler     ~ 1 min to read

A handy way to get an alias for the services installed on your UNIX box is the following script:

#! /bin/sh

for service in `cd /etc/init.d/; ls -1`; do
  alias "service-${service}"="/etc/init.d/${service}";

You can now access the service scripts with an alias which also work with command completion. So restart the network i.e. will be “service-network restart”.

Share on: