Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
/proc contains "virtual files" which are simply ways of viewing the various kernel data structures. The generic answer to your question is "read the file of interest and extract the desired data.".
Have any one of you tried anything with the proc file system ? If so, kindly share your experiences !
thanks !
It would help if you would tell us what you want to accomplish. e.g. Are you looking for ways to get information out of /proc or for clever ways to control you system by writing TO it.
Actually, I am trying to find out what can be done to os using the valuable information contained in the proc file system !! Currently I am finding ways to play with the linux operating system ! Thats why i asked if you have done something w.r.t proc file system !
Actually, I am trying to find out what can be done to os using the valuable information contained in the proc file system !! Currently I am finding ways to play with the linux operating system ! Thats why i asked if you have done something w.r.t proc file system !
thanks !
We can't answer unasked questions, and we can't get you to ask a specific question, so:
Actually, I am trying to find out what can be done to os using the valuable information contained in the proc file system !! Currently I am finding ways to play with the linux operating system ! Thats why i asked if you have done something w.r.t proc file system !
thanks !
got it!!!
Here you go.....
Q: What can I do with the /proc filesystem?
A-1: By reading from the various data structures in /proc you can directly access just about everything the kernel is doing.
A-2: By writing to these same structures, you can change what the kernel is doing without "going through channels". In some cases, this will enable clever tricks and in other cases, it may total destroy your system.
thanks for your reply, i did understand what u said, but can u give me at least 2 specific examples in which one achieves something my modifying/reading proc file systems !
"/proc" is one of the cleverest inventions I have seen in a very long time.
Historically, it has always been a huge problem to either "peek behind the curtains of the operating-system" or (heaven forbid!) to (legitimately...) "change something."
"/proc" is a brilliantly elegant solution.
The operating-system gives you the perfect illusion that "all sorts of system data" is available as a collection of read/write files. (You may or may not have permission to read and/or to write them, of course...)
Any ol' "perfectly ordinary, nothin' special, non-privileged" program can easily work with that.
None of these files "actually exist, anywhere." The entire directory and all of its contents are purely a figment of the operating system's imagination.
thanks for your reply, i did understand what u said, but can u give me at least 2 specific examples in which one achieves something my modifying/reading proc file systems !
thanks!
Sure. Here's one:
Code:
$ find /proc | while read path
do
echo "reading $path ..."
done
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.