Monday, July 21, 2008

ATAD #1 – linux /proc filesystem

It’s been a long time since i really sat down to read something, apart from what work demanded, technology round ups and reviews. Its this strange time in my life when academic acumen kicks in, and I wonder; “why not spend a few minutes each day to learn something new”.
I will log my learning’s with A Tip A Day.

Over the years I have understood that the /proc directory (also called the proc file system) contains files that store information about the state of the linux kernel and the running applications. The files can be interpreted by applications and the users (though a few are restricted only to the ‘root’ user) to gain a whole wealth of information about the running system. The contents of the files under the proc directory can be easily read using the cat program

OK, this is probably stale news for a few. But an interesting find was that a few files under /proc/sys can actually also be used to adjust settings to the kernel.

Eg, here im changing the hostname of the linux system to hoohaha

# echo hoohaha > /proc/sys/kernel/hostname

A few others store boolean information, for example the /proc/sys/net/ipv4/ip_forward when set to 1 will immediately start forwarding network packets.

# echo 1 > /proc/sys/net/ipv4/ip_forward

__tipped__

No comments: