Home > Linux > The Linux /proc Filesystem as a Programmers’ ToolThe Linux /proc Filesystem as a Programmers’ Tool Submitted by Eugenia 2005-06-19 Linux 10 CommentsProc: Manipulating all manners of runtime state information by using file-level system calls and commands. Read more at LinuxJournal. About The Author David AdamsFollow me on Twitter @david_adams 10 Comments 2005-06-19 10:36 pm Really. 2005-06-19 11:17 pm Hmmm… procfs is not deprecated by sysfs? (at least on Linux 2.6) 2005-06-19 11:42 pm Yeah, we really should be showing devs how to use /sys. /proc will probably be around for a while, but it sounds like its slowly being replaced by sysfs. 2005-06-20 1:37 am I think proc will stay around for always and will just lose some of the functionality that has always seemed misplaced. 2005-06-20 2:34 am I think the two are supposed to be for different things – sysfs is for exporting information on hardware devices, while procfs provides information about processes, memory use, kernel config, etc. 2005-06-20 5:46 am echo reboot >/dev/rebootor echo “dma on” >/dev/sdD0/ctlin Plan9 Can anybody do this in Linux ? 2005-06-20 10:13 am Afaik not; DMA is done via ioctls (which always struck me as “we can’t push the file metaphor any further, let’s put in a back door”). Regarding reboot, I’m sure I’ve seen a similar approach in linux.Of course, /proc is heavily inspired by plan9…“Some Plan 9 ideas have been absorbed into modern Unixes, particularly the more innovative open-source versions. FreeBSD has a /proc file system modeled exactly on that of Plan 9 that can be used to query or control running processes. […] Linux’s /proc file system, in addition to presenting process information, holds a variety of synthesized Plan 9-like device files used to query and control kernel internals using predominantly textual interfaces.”http://www.faqs.org/docs/artu/plan9.html 2005-06-20 1:15 pm > echo reboot >/dev/reboot> or echo “dma on” >/dev/sdD0/ctl> in Plan9 > Can anybody do this in Linux ? i did it. nothing happened.except echo reboot > /dev/reboot would make file reboot in /dev/ 2005-06-20 2:53 pm The sysctl mechanism used in the *BSDs is much better anyway. I’ve always thought it was a bit stupid to have the kernel export information in plain text via the /proc tree to have it parsed by your application back into usable data. And, of course, it’s completely non-portable to other unices, in a typical GNU NIH way. 2005-06-20 5:32 pm Linux also has the sysctl system call. /proc/sys is sysctl support, exported as a psuedo filesystem.