System V

Review Chapter 7, Linux Files and Processes, section: Terminating/Restarting Processes Using Scripts, and Chapter 3, Startup and Shutdown, “Initialization and Startup Scripts”, in Linux System Administration

Also see Mayank Sarup’s article at


0 – Shutdown. Get here by running the command init 0.

1 – Single-user mode. init 1

2 – Multi-user, no networking mode. init 2

3 – Multi-user, with networking, command-line mode. init 3

4 – (Usually) unused mode. init 4

5 – Multi-user, with networking, X11 (GUI) mode. init 5

6 – Reboot mode. init 6

You can check your current runlevel, and the immediately preceding runlevel, with the runlevel command.


The inittab file

This file is /etc/inittab . cat or less this file, and note the Default Runlevel section.

See the line:


Do NOT set initdefault to 0 or 6!


Startup and Shutdown Scripts

In a terminal window, go to /etc/rc.d .
Run an ls command, then cat each of these:

rc – controls all movement between runlevels

rc.sysinit – runs once on system startup

rc.local – runs once, after everything else, on system startup


Where the Scripts Live

Change directories to /etc/init.d and run an ls command.

These are the actual scripts. Cat a few and notice how they handle multiple conditions (similarly to a class): start, stop, reload and status.


Where the Scripts Are Called

Change directories to /etc/rc3.d and run an ls command.

“K” scripts kill processes (services); “S” scripts start processes. The following number is a priority number.


The ln Command

This is a good time to learn about the ln command.


Startup Logging

You can see the startup logging information (the “kernel ring buffer”) by running the command:

dmesg #or /bin/dmesg

You’ll see the information that scrolled past on the screen as your system booted.


To see information about the success or failure of startup scripts (the ones in /etc/rc.d/) look at the file /var/log/boot.log.

To see kernel and system messages, see the file /var/log/messages.

All system logs are rotated by the logrotate script, configured by the file /etc/logrotate.conf.

Finally, current information about the system is in the /proc (virtual) filesystem.


See these files in /proc/:

interrupts – IRQ info

cpuinfo – CPU info

dma – DMA info

ioports – I/O info

meminfo – Memory info: available, free, swap, cached

loadavg – System load avg

uptime – Time since boot

version – Kernel version

scsi – SCSI info, if any

ide – IDE info

net – Network info

sys – Kernel config parameters


Runlevel and Shutdown Commands
init [0-6]

Change the computer’s state to the designated runlevel

shutdown -h now Shut down, hard, now
shutdown -r now Shut down and reboot now
shutdown -h +5 Shut down in 5 minutes
shutdown -r+5 “The system is going down in 5 minutes” Shut down in 5 minutes after displaying a message to users
shutdown -c Cancel a shutdown in progress
halt Halt the system immediately
reboot Reboot the system immediately