During learning about Linux file execution mechanism, I found a file in the following directory which is "write-only" (even for root user!):
ebra@him:/proc/sys/fs/binfmt_misc$ ll register
--w------- 1 root root 0 Aug 19 19:15 register
My question is: What is the usage of this [kind] of file[s]? What is the use of a file that can not be read at all?
See the documentation. This is not a normal file; it's an interface to the kernel's mechanism for setting up binary formats. You add a new format by writing a string to this "file" in a specific format. The kernel uses that string to set up the new binary format, but there'd be no point in saving the string itself. So you wouldn't be able to read back the string you wrote, and it's not clear what else you might expect to read from that file.
If you want to see what formats have been registered, you look at the other files in that directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With