3 Answers
3

Those files are related to the processes created by the OS on behalf of you. Those files store real-time information about the processes, such as memory-block used by the processes, opened files by the processes, names of files which are accessed by your processes.

Those files are created by the OS, that is Ubuntu for you. As Ubuntu, i.e the OS has full permission on the file system, so, it can create any file anywhere

Let's do an experiment:

For experiment, run these line of codes in your terminal

First see the number of files in /proc on behalf of you

ll /proc/ | grep lyg | wc -l

Then create another process. Let the new process be another bash instance. So type bash and hit Enter.

Again execute this command

ll /proc/ | grep lyg | wc -l

you can now see that, there is at least 1 more file. This file is created for the new process

Then now exit the newly created bash, with exit command.

Now again type this command:

ll /proc/ | grep lyg | wc -l

You will see that, the output now is 1 less than the previous. Because, The OS deleted the file corresponding the just existed or terminated bash process.

Those files in /proc/nnnnn are created by the kernel for every process (PID) running on your system and contain low-level process-related information and data.

As you may know, the superuser (or root) can create files with any ownership and any permissions...and the kernel effectively runs with full privileges (as "root"), so it can create those files in your name.