Chapter 9. Configuration of the Kernel

Table of Contents

The /proc filesystem:

The /proc filesystem:

The /proc filesystem is a pseudo-filesystem, which acts as an interface to kernel data structures. Most of it is read-only, but some files allow kernel variables to be changed.

You can use the cat command to view the contents of most files, and can use a combination of echo and a redirect to set the values for files you wish to change.

As an example, we'll change the hostname of the system, at least as far as the kernel is concerned.

The relevant file in the /proc system is /proc/sys/kernel/hostname.

debian:~# cat /proc/sys/kernel/hostname
debian
            

As we can see, the current value is "debian"; this is the name that we have given our machine.

We can also verify this with the hostname command:

debian:~# hostname
debian
            

To change the hostname to "something":

debian:~# echo something > /proc/sys/kernel/hostname
debian:~# hostname
something
debian:~# cat /proc/sys/kernel/hostname
something
            

Obviously, this change has only been made in the currently running kernel, and will be lost when the system is next booted.

excercise:

where would you set this value in order for it to become permanent?