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

I'm confused as to which is best and in which circumstances:

invoke-rc.d apache2 restart


service apache2 restart

Is there a real difference?

man service has the following interesting bit:

service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to /.

I'm interested mainly in Debian, but also Mint (also based on Debian).

share|improve this question
up vote 8 down vote accepted

The official Debian wiki page on daemons says to use service:

# service ssh restart
Restarting OpenBSD Secure Shell server: sshd.

Functionally service and invoke-rc.d are mostly equivalent, however:

  • invoke-rc.d is the preferred command for packages' maintainer scripts, according to the command's man page
  • service has a unique --status-all option, that queries status of all available daemons

It seems like service is the user-oriented command, while invoke-rc.d is there for other uses.

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.