Originally Published: Friday, 12 January 2001 Author: Tom Dominico, Jr.
Published to: enhance_articles_sysadmin/Sysadmin Page: 1/1 - [Std View]

Using the /proc Filesystem

Join Tom Dominico in exploring one of the corners of the Linux kernel, through your file system and the cat utility! Find out more about this valuable source of information.

If you're like me, you enjoy poking around in your directory tree, hunting for interesting things. Perhaps you've noticed the /proc file-system, but haven't had much of a clue as to what it is used for. It contains a number of odd entries such as "meminfo", "kmsg", "interrupts", etc. If you've ever tried to do a "cat" on these files, you were probably greeted with a set of odd words and numbers that may not have made much sense at the time. However, for those who know how to use it, the /proc file system can be a valuable source of information about your Linux system.

The /proc file system is only a "virtual" file system. What this means is that none of the "files" that it contains are stored on your hard disk. Rather, it is a way to easily access dynamic information about your system at any time, and only exists in memory. Working with a Linux system sometimes requires a more in-depth knowledge of your system than other operating systems, such as, "what PCI devices do I currently have in my system? What interrupts are currently in use?" As you become more of a "power user", you'll find some of this information to be valuable as you perform certain tasks. Besides, isn't it just plain cool to have all this information at your fingertips? Imagine how impressed your friends will be as you rattle off the interrupts that are currently in use on your system! You'll be the life of the party for sure. (Well, at a LAN party, perhaps).


As you can see, there's a wealth of information to be found by looking in the /proc virtual file system. Some of it is human-readable, and some is used by various command-line utilities that format and present it in an easy-to-understand fashion. Sometimes these utilities may also add a little information of their own. For example, the command "uname -a" gets much of its information from /proc/version, while the "uptime" command provides information from both /proc/uptime and /proc/loadavg, as well as other sources. Don't be afraid to get your hands dirty and find out what each virtual file does - there are many that we didn't cover. The knowledge you gain will no doubt become valuable to you over time, whether you're a sysadmin or simply run your own box at home. So, the next time you're wondering, "What speed CPU is in this box?", don't reach for your system documentation - just head over to /proc.