[Home] [Credit Search] [Category Browser] [Staff Roll Call] | The LINUX.COM Article Archive |
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.
|
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).
Examples
bash$ cat /proc/cpuinfo
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 5
model name : Pentium II (Deschutes)
stepping : 2
cpu MHz : 349.135
cache size : 512 KB
bash$ cat /proc/meminfo
MemTotal: 127920 kB
MemFree: 3192 kB
MemShared: 117728 kB
Buffers: 2620 kB
Cached: 21752 kB
SwapTotal: 514072 kB
SwapFree: 446336 kB
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.