Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are there any standards for aliasing sudo /etc/init.d/? I'm sure many people have considered cutting down these 17 characters to just 2 or so.

share|improve this question
Interesting idea. – Tim Jun 5 '12 at 20:40
up vote 6 down vote accepted

On Linux with SysVinit (the traditional init implementation), the service command is a shell script that calls a script in /etc/init.d.

sudo service wibble restart

service also knows to look for Upstart jobs if available. Upstart also comes with start, stop, reload and restart commands.

sudo restart wibble

I recommend keeping sudo to remind you that this is something performed as root.

share|improve this answer

Something to consider, most systems have the "service" command, that could replace the /etc/init.d/ portion of your sudo command.

You could do for example:

alias sserv="sudo service"

example: (pay no attention to the root behind the curtain)

[root@talara javaWs.git]# sserv pdns restart
Restarting PowerDNS authoritative nameserver: stopping and waiting..done
Starting PowerDNS authoritative nameserver: started
share|improve this answer
Good to know. Never used that alias before. – Tim Jun 5 '12 at 20:56

Have a look at the this snippet in Grmls zshrc. It defines 5 function Start Stop Restart Reload Force-Reload to start/stop a daemon.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.