50

Does anybody have an idea about the full form of rc.d in, for example, /etc/rc.d?

It contains scripts to used to control the starting, stopping and restarting of daemons. But what exactly is the meaning of rc here?

jasonwryan
  • 73,126
  • Are you asking about the at command? Or about the directory? Please change your question so that "yes I have a clue" is not a correct (but useless) answer. – Timo Jan 30 '14 at 06:56
  • See http://en.wikipedia.org/wiki/Rc_file – jasonwryan Jan 30 '14 at 06:58

2 Answers2

49

This goes pretty far back in the Unix history. rc stands for "run commands", and makes sense actually:

rc

runcom (as in .cshrc or /etc/rc) The rc command derives from the runcom facility from the MIT CTSS system, ca. 1965. From Brian Kernighan and Dennis Ritchie, as told to Vicki Brown:

"There was a facility that would execute a bunch of commands stored in a file; it was called runcom for "run commands", and the file began to be called "a runcom". rc in Unix is a fossil from that usage."

Source

The idea of having the command processing shell be an ordinary slave program came from the Multics design, and a predecessor program on CTSS by Louis Pouzin called RUNCOM, the source of the ".rc" suffix on some Unix configuration files. The first time I remember the name "shell" for this function was in a Multics design document by Doug Eastwood (of BTL). Commands that return a value into the command line were called "evaluated commands" in the original Multics shell, which used square brackets where Unix uses backticks.

(source)

In summary, rc.d stands for "run commands" at runlevel which is their actual usage. The meaning of .d can be found here What does the .d stand for in directory names?

Please don't mix up with rc the shell interpreter which was included in Plan 9, which were descendant of Bourne Shell.

Braiam
  • 35,991
11

If you're asking what the meaning of the acronym rc is, according to the jargon file, it derives from runcom:

rc file: /R�C fi:l/, n. [Unix: from runcom files on the CTSS system 1962-63, via the startup script /etc/rc] Script file containing startup instructions for an application program (or an entire operating system), usually a text file containing commands of the sort that might have been invoked manually once the system was running but are to be executed automatically each time the system starts up. See also dot file, profile (sense 1).

Source: http://www.catb.org/jargon/html/R/rc-file.html

Run levels

In version 7 Unix the /etc/rc's were replaced with runlevels. So on a modern day Linux box you'll see this type of directory structure.

The runlevel system replaced the traditional /etc/rc script used in Version 7 Unix.

Source: https://en.wikipedia.org/wiki/Runlevel

$ ls -l
total 32
drwxr-xr-x. 2 root root 4096 Jan  3 12:21 init.d
drwxr-xr-x. 2 root root 4096 Jan  3 12:21 rc0.d
drwxr-xr-x. 2 root root 4096 Jan  3 12:21 rc1.d
drwxr-xr-x. 2 root root 4096 Jan  3 12:21 rc2.d
drwxr-xr-x. 2 root root 4096 Jan  3 12:21 rc3.d
drwxr-xr-x. 2 root root 4096 Jan  3 12:21 rc4.d
drwxr-xr-x. 2 root root 4096 Jan  3 12:21 rc5.d
drwxr-xr-x. 2 root root 4096 Jan  3 12:21 rc6.d

Each of these directories represents a runlevel. Different distros use these in slightly different ways. For example, on Red Hat based distros run level 3 is meant for running a system without a desktop, while 5 is meant for when running a desktop.

To designate that you wanted a particular service to start in one level vs. not in another you'd initially have to create links to the actual rc scripts for a particular service, naming the link in a special way. The links would look like this:

$ ls -l rc3.d/
total 0
lrwxrwxrwx. 1 root root 20 Dec  7 20:56 K50netconsole -> ../init.d/netconsole
lrwxrwxrwx. 1 root root 18 Dec  7 20:56 K85ebtables -> ../init.d/ebtables
lrwxrwxrwx. 1 root root 17 Dec  7 20:56 K90network -> ../init.d/network
lrwxrwxrwx. 1 root root 28 Jan  3 12:21 S04dkms_autoinstaller -> ../init.d/dkms_autoinstaller
lrwxrwxrwx. 1 root root 15 Dec 14 22:57 S95jexec -> ../init.d/jexec

Names starting with a K meant that this service should be killed for this runlevel, while S meant that it should be started. The numbers after the K & S denoted what order the services should be killed and started.

In recent years this approach has started to wain in favor of 2 new technologies,systemd & upstart.

slm
  • 369,824