Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
It's just a convenient interface provided by kernel following the Unix philosophy "everything is a file". This answers the question "Why is it a file system?" which is the correct one to ask.
It's just a convenient interface provided by kernel following the Unix philosophy "everything is a file". This answers the question "Why is it a file system?" which is the correct one to ask.
Actually it was in an interview he asked me why is it created on fly and why is not a permanently residing on server ?
/proc isn't a real filesystem. It's a window into the running kernel dressed up as a filesystem for the user's convenience. It's created on the fly because each run of the kernel is different, at least potentially.
As well as info on the kernel, hardware drivers, etc., /proc contains the task structures created by the kernel for all running processes. These are the subdirectories with numbers for names. The numbers are the PIDs of the processes. Obviously this sort of info can't be permanently stored on disk.
The reason it doesn't exist on disk is that it is created in kernel cache - i.e. in RAM. You (the user) don't have to worry about mounting it, what filesystem it uses ...
To make things a little clearer, consider this command
Code:
$: cat /proc/cpuinfo
Normally cat reads a file and copies the contents to the terminal. But there is no file there! What actually happens is that the OS gets the data represented by the name /proc/cpuinfo by sending a request to the CPU, which comes up with the information.
Now try
Code:
$: cat /proc/sys/kernel/sysrq
This asks the kernel if it recognises the "magic system request" key. If it replies "1" it does, if "0" it doesn't. This is one of the "entries" in /proc that you can actually alter (and that can sometimes be a dangerous thing to do!) with
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.