//View Tip #162
Similar Tips
» Counts files in the current directory and subdirectory
» Share current tree over the web
» List non-system users
» ssh proxy forwarding
» Un-alias a command


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Create rc* alias for each init.d script. (can be include at /root/.bashrc)

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

SuSE distribution has a rc'service' for each init.d script that enables to easily start/stop service; but Debian and Ubuntu have not.

View Comments »


Add your comment

Comments are currently disabled
WRONG: `cd /etc/init.d/; ls`
RIGHT: /etc/init.d/*

also notice that "${service}" will get expanded to the full path so your result will be: "alias rc/etc/init.d/network=/etc/init.d//etc/init.d/network" for example.

the correct way is:

 for service in /etc/init.d/*; do
     alias "rc${service##*/}=$service"
Posted 2009-02-12 17:41:46

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit