The /etc/inittab file is the configuration file used by the System V (SysV) initialization system in Linux. This file defines three items for the init process:
- the default runlevel
- what processes to start, monitor, and restart if they terminate
- what actions to take when the system enters a new runlevel
Once all the entries in /etc/inittab for your runlevel are executed, the boot process is completed, and you can log in.
Each line in the inittab file consists of four colon-delimited fields:
Here is a description of these fields:
- id (identification code) – consists of a sequence of one to four characters that identifies its function.
- runlevels – lists the run levels to which this entry applies.
- action – specific codes in this field tell init how to treat the process. Possible values include: initdefault, sysinit, boot, bootwait, wait, and respawn.
- process – defines the command or script to execute.
Consider the following example:
In the picture above you can see that the runlevels are defined as:
The lines start with codes that begin with an l (a lowercase L) followed by the runlevel number—for instance, l0 for runlevel 0. These lines specify scripts or programs that will be run when the specified runlevel is entered. In our case, all the scripts are the same (/etc/init.d/rc), but the script is passed the runlevel number as an argument.