0

Why the directories inside /proc/sys/net/ipv4/config have no hard links?

ls -l /proc/sys/net/ipv4/conf
total 0
dr-xr-xr-x 0 root root 0 Dec 31 08:27 all
dr-xr-xr-x 0 root root 0 Dec 31 08:27 default
dr-xr-xr-x 0 root root 0 Dec 31 08:27 eth0
dr-xr-xr-x 0 root root 0 Dec 31 08:27 lo
1

The directories in /proc do not really exist. It is a virtual filesystem with information which is generated on the fly. Hardlinks have no place in them (and would not save any space if you could use them).

0

The directories in /proc/sys/net/ipv4/conf are neither hardlinks¹ nor softlinks¹. But that is of no interest.

The important thing is, that procfs (proc filesystem) is a special filesystem, usually mounted at /proc, that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized method for dynamically accessing process data held in the kernel.

In other words the procfs provides a method of communication between kernel space and user space. The files in the procfs show the content of variables in kernel space. And the kernel is the piece of software, that communicates with the hardware of the computer.

¹) As mdpc said, ls -l shows the link count in the first line. And that is zero in the procfs.

0

In fact if you look at the link count, they are not links at all (ls -l shows link counts, in this case the link count is equal to zero).

Others have specified that files in /proc, are convenient for accessing selected kernel data easily and programatically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.