In Linux, proc is a virtual file system and a control center that can change the running status of the kernel by changing some of the files; it is also a query center provided by the kernel to us, through which users can view the system. Hardware and currently running process information. The proc system only exists in memory and provides an interface for accessing system kernel data in the form of a file system. The kernel operating status can be changed by changing some of the files.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
What is proc file system
proc is called a virtual file system, it is a control center that can change the kernel operation by changing some of the files Status, it is also a query center provided by the kernel to us. Users can use it to 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.
Detailed explanation of linux proc file system
The /proc directory on the Linux system is a file system, that is, the proc file system. Different from other common file systems, /proc is a pseudo file system (that is, a virtual file system). It only exists in memory and does not occupy external memory space. It uses a file system to access system kernel data. Operation provides an interface), which stores a series of special files that store the current kernel running status. Users can use these files to view information about the system hardware and currently running processes, and even change the running status of the kernel by changing some of these files.
Directory, each process currently running in the system has a corresponding directory in /proc Below, the PID number of the process is used as the directory name.
-
directory, which provides security Relevant attributes are readable and writable. To support security modules such as SELinux, CONFIG_SECURITY needs to be configured.
- file, current security-related attributes.
- file, security-related attributes set when executing the execve command.
- file, security-related attributes set when executing commands open, mkdir, symlink, mknod.
- file, security-related attributes set when executing the command add_key.
- file, the security-related attributes when the command execve was last executed, that is, the previous "/ proc/[pid]/attr/current".
- file, security-related attributes set when creating the socket.
- file can be used to modify the CPU bandwidth allocated to automatic groups. This is done by writing a number in the "nice" range to set the nice value for the automatic grouping. The value range is 19 (low priority) ~ -20 (high priority). (Writing values outside this range will cause write(2) to fail with the error EINVAL.)
-
file, ELF interpreter information, the format is an unsigned long type ID plus an unsigned long type value , and finally two 0s (man getauxval).
-
file, the control group to which the process belongs, the format is three fields separated by colons, respectively Structure ID, subsystem, control group, CONFIG_CGROUPS needs to be configured.
-
File, write-only, only used by the owner of the process, clear for estimating memory usage There are four strategies 1, 2, 3, and 4 for the amount of PG_Referenced and ACCESSED/YOUNG. 1 means clearing all related pages, 2 means clearing related anonymous pages, 3 means clearing related mapping file pages, and 4 means clearing related pages. For soft-dirty pages, CONFIG_PROC_PAGE_MONITOR needs to be configured.
-
File, read-only, saves the complete command line string to start the process, if it is a zombie process, this file is empty.
-
File, command name of the process, different threads (man clone prctl pthread_setname_np) may be different The thread name is located in "task/[tid]/comm". If the name exceeds TASK_COMM_LEN, it will be truncated.
-
file, coredump filter, such as 00000037 (man core), different binary bits represent filtering Different information.
-
file, node that controls CPU and memory (man cpuset).
-
directory, a symbolic link to the current working directory.
-
File, environment variable.
-
file, symlinked to the full command to start the process. q
-
directory, containing the current fd, these fd symbolic links to the actual open files.
-
Directory contains information about the current fd. Different types of fd have different information.
-
file, information about group IDs mapped from user namespaces (man user_namespaces).
-
File, IO information.
-
File, resource soft and hard limits (man getrlimit).
-
file, the audit daemon enables auditing tools in the kernel. Any process running before auditing is turned on in the kernel will get loginuid 4294967295.
4294967295 is just (unsigned long) -1. -1 means loginuid is not set. This is normal behavior for processes not spawned by any login process (such as a daemon). loginuid defaults to -1; whenever you log in (in tty/in DM/via ssh), the pam_loginuid module changes it to your user ID, and the value is retained by the child process. -
Directory, including some memory mapped files (man mmap), the file name format is BeginAddress-EndAddress , the symbolic link to the mapped file needs to be configured with CONFIG_CHECKPOINT_RESTORE.
-
File, memory mapping information.
-
file is used to access the memory pages of the process through open, read, and lseek.
-
File, mount information, format is 44 41 253:1 // rw,relatime shared :35 master:1 - ext4 /dev/vda1 rw,data=ordered, with spaces as separators. The meanings of each field from left to right are the unique mount ID, the parent mount ID, and the device master-slave number of the file system. , the root node mounted in the file system, the mount point relative to the process root node, mount permissions and other mounting configurations, optional configurations, dashes indicate the end of the previous optional configurations, file system types, file system specific The mounting source may be none or additional configuration.
-
File, file system list mounted in the current process, /dev/vda1/ext4 rw ,relatime,data=ordered 0 0 Format reference (man fstab).
-
File, mount information, format is device /dev/vda1 mounted on / with fstype ext4[statistics].
-
Directory, saves network-related files and directories of the process.
-
directory saves the entry of each namespace, see (man namespaces) for details.
-
file, numa is Non Uniform Memory Access, see (man numa) for details.
-
file, adjust the OOM score. OOM is Out Of Memory. When OOM occurs, OOM Killer kills the process with a high score based on the OOM score. The default value is 0 and will inherit the settings of the parent process.
-
File, OOM score.
- file, the OOM score ranges from -1000 to 1000.
- file, the virtual memory page mapping information of the current process, needs to be configured with CONFIG_PROC_PAGE_MONITOR.
- file makes the process personality flag visible in /proc. Because the personality of a process may be sensitive (such as READ_IMPLIES_EXEC), this file can only be read by the process owner.
- file, similar to user and group ID mapping, can create project ID mapping for user namespaces . (Item ids are used for disk quotas; see setquota(8) and quotactl(2).)
- file that exposes the patch status value for each task so that users can determine which tasks are preventing the completion of the patch operation.
-
##root -> The / directory is linked to the root directory of the current process.
-
##sched file, scheduling statistics and status information of the process.
-
setgroups file, if the process containing the process pid in the user namespace is allowed to use setgroups(2) System call, the /proc/[pid]/setgroups file displays the string "allow"; if setgroups(2) is not allowed in the user namespace, "deny" is displayed. Note that regardless of the value in the /proc/[pid]/setgroups file (and regardless of the capabilities of the process), calling setgroups(2) is not allowed if /proc/[pid]/gid_map has not been set.
-
smaps Files, memory mapping information, similar to the pmap command, need to configure CONFIG_PROC_PAGE_MONITOR.
-
stack file, the function call stack of the kernel space, needs to be configured with CONFIG_STACKTRACE.
-
statm file, process memory usage information, 7 numbers separated by spaces, from left to right Respectively represent the total size of the program, resident memory size, shared memory page size, text code, library, data stack, and dirty pages.
-
syscall file, system call related information, needs to configure CONFIG_HAVE_ARCH_TRACEHOOK.
-
task Directory, one subdirectory for each thread, and the directory name is the thread ID.
-
timers file, POSIT timer list, including timer ID, signal and other information.
-
wchan file, the symbolic representation of the corresponding location in the kernel when the process is sleeping, such as do_wait.
acpi/wakeup file, device wakeup operation.
buddyinfo file, used to diagnose memory fragmentation problems.
bus Directory, installed bus.
- ##pci/00/00.0-08.0
- pci/devices
cgroupscgroups information summary, field subsys_name hierarchy num_cgroups enabled.
cmdline file, parameters passed to the Linux kernel when the system starts, such as lilo, grub and other boot management module.
file, to view the currently used device line characters in the system console /dev/console, you can simply View the /proc/console file. file, CPU and system architecture information, use the lscpu command this file. file, the encryption list provided by the kernel encryption API. files, device related information. File, disk status. file, dma is Direct Memory Access. file, linked to /self/mounts. File, Memory Type Range Registers. directory, related to the network pseudo file system. file, other page allocator information. File, partition information. file, scheduler debug information. file, scheduler information. Directory, SCSI interface device. directory, linked to the directory where the current process is located. file, kernel cache information, CONFIG_SLAB needs to be configured. file, system soft interrupt information. File, system and kernel statistics. File, swap partition usage. Directory, system variable related information. File, writable, triggers system call. directory includes three files: msg, sem, and shm, which are System V IPC objects. file, list of timers that are still running. File, timer status. Directory, tty device related. File, system update time and process idle time. file, kernel version information. file, virtual memory allocation information. file, memory statistics, displayed in the form of key-value pairs. file, memory block information, used to analyze the behavior of virtual memory. Related recommendations: "Linux Video Tutorial"
file, execution domain list.
file, Frame Buffer information, CONFIG_FB needs to be configured.
File, file system type supported by the kernel (man filesystems).
Directory, mounted file system information.
file, interrupt information for each IO of each CPU. The irq number, the number of times each CPU processes the irq, the name of the interrupt controller, the name of the irq, and the name used by the driver to register the irq are displayed in sequence.
File, IO memory mapping information.
file, IO port information.
directory, the following will create a subtitle with the irq number as the name for each registered irq. Table of contents.
file, used for dynamic linking and symbol definitions bound to modules.
file, physical memory in ELF format in the system.
file exposes the list of keys that the reading thread has permission to view and provides information about each Various information for each key. The thread is not required to own the key, which is visible in this file.
file that lists every user who has at least one key on the system Various information about the ID.
file, kernel log information, this file is used by the dmsg command.
file, the number of times each physical page frame is mapped, needs to be configured CONFIG_PROC_PAGE_MONITOR.
file, the mask of each physical page frame, needs to be configured CONFIG_PROC_PAGE_MONITOR.
file, current system load.
File, the current file lock status.
file, virtual device information (soft raid, etc.).
file, system memory usage statistics, this file is used by the free command.
# files, drivers registered on other major devices (device number 10).
file, module information loaded by the system, the related command is lsmod.
The above is the detailed content of What file system is proc under linux?. For more information, please follow other related articles on the PHP Chinese website!

The five core components of the Linux operating system are: 1. Kernel, 2. System libraries, 3. System tools, 4. System services, 5. File system. These components work together to ensure the stable and efficient operation of the system, and together form a powerful and flexible operating system.

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver CS6
Visual web development tools
