What is proc in linux

WBOY
WBOYOriginal
2022-03-16 16:53:428359browse

In Linux, proc is a virtual file system and a control center, which stores a series of special files that are the current kernel running status; the system only exists in the memory and is accessed through the file system. The kernel data operation provides an interface, and the kernel running status can be changed by changing some of the files.

What is proc in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is proc in linux

proc is called a virtual file system. It is a control center that can change the running state of the kernel by changing some of the files. It is also provided by the kernel to us. Query center through which users can view system hardware and currently running process information.

The data source of many tools in Linux is the content in the proc directory. For example, the lsmod command is an alias of cat /proc/modules.

There is a special type of pseudo file system in Linux, which is used to complete various functions using operations unified with the file interface, such as ptyfs, devfs, sysfs and procfs. Procfs is one of the most widely used pseudo file systems.

As far as the term file system is concerned, the /proc directory is not a real file system. It is a virtual file system, sometimes also called a process information pseudo file system.

The data placed by proc is all in the memory, such as the system kernel, process, status of external devices and network status, etc. Because the data in this directory is in memory, it does not occupy any hard disk space.

procfs is an abstract file interface for Linux kernel information. A large number of kernel information and adjustable parameters are mapped to a directory tree as regular files, so that we can simply and directly use echo or cat. File operation commands are used to retrieve and adjust system information. At the same time, procfs also provides an interface so that our own kernel modules or user-mode programs can transfer parameters through procfs. In today's Linux systems, a large number of system tools also obtain kernel parameters through procfs, such as ps, lspci, etc. Without procfs, they may not work properly.

The proc file system is a pseudo file system. It only exists in the memory and does not occupy external memory space. It provides an interface for accessing system kernel data in the form of a file system. Users and applications can obtain system information through proc and change certain parameters of the kernel. Since system information, such as processes, changes dynamically, when a user or application reads a proc file, the proc file system dynamically reads the required information from the system kernel and submits it.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What is proc in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What is ha in linuxNext article:What is ha in linux