1./the proc directory Linux kernel provides a/The proc file system, which accesses kernel internal data structures at run time, and changes the kernel setting mechanism. The proc file system is a pseudo-file system that only exists in memory and does not occupy external memory space. It provides an interface for accessing system kernel data in a file system manner. Users and applications can get system information through proc, and can change certain parameters of the kernel. Because the information of the system, such as the process, is dynamically changed, so when the user or application reads the proc file, the proc file system dynamically reads the required information from the system kernel and submits it. These files or subfolders listed below are not always present in your system, depending on your kernel configuration and the modules that are loaded. In addition, the/There are three other important directories under proc: NET,SCSI and Sys. The SYS directory is writable and can be used to access or modify kernel parameters, while net and SCSI depend on the kernel configuration. For example, if the system does not support SCSI, the SCSI directory does not exist. In addition to the above, there are a number of directories named, they are the process directory. Each process currently running in the system has a corresponding directory/proc, the PID number of the process is the directory name, which is the interface to read the process information. The self directory is the information interface of the read process itself and is a link. 2. Child files or subfolders/proc/Buddyinfo How many blocks of each order in each memory area are available, related to memory fragmentation issues/proc/cmdline parameter information passed to kernel at startup/proc/Cpuinfo CPU Information/proc/crypto all installed cryptographic passwords and details used by the kernel/proc/devices devices that have been loaded and sorted/proc/DMA registered with the ISA DMA channel list/proc/execdomains The Linux kernel currently supports execution domains/proc/FB Frame buffer device list, including the number and drive to control it/proc/file system types currently supported by the Filesystems kernel/proc/interrupts number of IRQ interrupts in the x86 architecture/proc/Iomem The current mapping of each physical device in system memory/proc/Ioports the registration port range used by the input and output of a device/proc/Kcore represents the physical memory of the system, stored as the core file format, which shows the number of bytes, equal to the RAM size plus 4kb/proc/kmsg records the information generated by the kernel, either through/SBIN/KLOGD or/bin/DMESG to handle it./proc/loadavg Load status based on CPU and IO status over a period of time, related to the uptime command/proc/list of files locked by the locks kernel/proc/mdstat multi-drive, RAID configuration information (md=multiple disks)/proc/meminfo information about RAM usage/proc/Misc Other major equipment (device Number 10) on the registered driver/proc/modules List of all modules loaded into the kernel/proc/mounts all mounts used in the system/proc/Memory Type Range registers (MTRRS) used by the MTRR system/proc/block allocation information in a partitions partition/proc/List of PCI devices in PCI system/proc/Slabinfo Slab Cache information for all activities in the system/proc/Stat All CPU activity information/proc/sysrq-trigger when using the echo command to write this file, the remote root user can perform most of the system request critical commands as if they were executed on the local terminal. To write this file, you need to put the/proc/sys/kernel/SYSRQ cannot be set to 0. This file is unreadable to root./proc/How long has the uptime system been running ?/proc/use of swaps swap space/proc/Version Linux kernel and GCC versions/proc/bus system bus information, such as pci/USB, etc./proc/Driver Driver Information/proc/FS File System Information/proc/IDE IDE Device information/proc/IRQ Interrupt Request device Information/proc/NET network card device information/proc/SCSI SCSI Device Information/proc/TTY TTY device information/proc/net/Dev Display network adapter and statistics/proc/Vmstat Virtual Memory Statistics/proc/vmcore memory image when kernel panic/proc/diskstats Obtaining disk information/proc/Schedstat Kernel Scheduler Statistics/proc/Zoneinfo shows the statistics of memory space, which is useful for analyzing virtual memory behavior The following is/information about process N in the proc directory/proc/n process information for PID N/proc/n/cmdline Process Start command/proc/n/CWD linked to the current working directory of the process/proc/n/Environ Process environment variable list/proc/n/exe link to the execution command file of the process/proc/n/FD contains all the file descriptors associated with the process/proc/n/maps and process-related memory mapping information/proc/n/mem refers to the memory that is held by the process, unreadable/proc/n/Root is linked to the roots of the process/proc/n/status of the stat process/proc/n/The state of the memory used by the STATM process/proc/n/status process state information, more than stat/STATM More readable/proc/Self link to the currently running process3. Example3.1/proc/[email protected]:~$ ls/proc/1 16819 21242 2180 2494 8768Interrupts Partitions116 16820 21244 2181 2524 885Iomem Sched_debug11740 17901 21245) 21810 2525ACPI Ioports SCSI11742 17903 21247) 21812 3asound IRQ Self11743 17904 2131) 21813 39buddyinfo kallsyms slabinfo13452 18362 21319) 21923 4Bus Kcore Stat13454 18364 2132 2193 cgroups key-Users swaps13455 18365 2139) 21933 42cmdline kmsg Sys149 19451 2142 2209 5 cpuinfo kpagecount sysrq-Trigger150 19453 21572) 2212 5330Crypto kpageflags SYSVIPC151 19454 21574) 2219 596Devices Loadavg timer_list152 2 21575) 2243 597diskstats Locks Timer_stats15771 2083 2158) 2260 6DMA Meminfo TTY15773 2092 21625) 2261 617Driver Misc Uptime15774 2101 21627) 2262 619execdomains Modules version16232 21112 21628) 2263 7FB Mounts Vmallocinfo16234 21115 2165) 2264 804filesystems MTRR Vmstat16235 21116 2167) 2265 8765FS Net Zoneinfo16811 2112 2177) 2338 8767IDE Pagetypeinfo3.2/proc/SYS System Information and kernel parameters [email protected]:~$ ls/proc/sysdebug Dev FS kernel net VM3.3/proc/NET network card device information [email protected]:~$ ls/proc/netanycast6 ip6_flowlabel netfilter raw6 sockstat6 udplitearp ip6_mr_cache netlink Route Softnet_stat udplite6dev ip6_mr_vif netstat rt6_stats stat unixdev_mcast ip_mr_cache Packet Rt_acct TCP vlandev_snmp6 ip_mr_vif protocols rt_cache tcp6 Wirelessif_inet6 Ipv6_ro Ute psched SNMP tr_rifigmp mcfilter ptype snmp6 udpigmp6 Mcfilter6 Raw Sockstat UDP63.4/proc/SCSISCSI device information [email protected]:~$ ls/proc/Scsidevice_info SCSI3.5/proc/modules List of all modules loaded into the kernel [email protected]-a-2-1-2:~#Cat/proc/modulesBdspboard8486 2 Dspcontrol, Live 0xe134c000Dspcontrol9575 1 Clkmon, Live 0xe135b000Clkmon6765 1-live 0xe136c000Diagint6635 1-live 0xe1379000Bdsprio10775 2 srioif,tsi577, Live 0xe9389000tsi57717998 1 srioif, Live 0xe939e000srioif7329 0-live 0xe93b2000Linux_kernel_bde54666 1 Linux_user_bde, Live 0xf1417000(P) Linux_user_bde17849 0-live 0xf1427000(P) [email protected]-a-2-1-2:~#3.6/proc/devices already loaded devices and categories [email protected]-a:~#cat/proc/devicesCharacter Devices:1Mem2Pty3Ttyp4/dev/vc/04TTY4TTYs5/dev/TTY5/dev/Console5/dev/PTMX7VCs10Misc13input89I²c90MTDlinux-user-Bde2117 linux-kernel-Bde2126 linux-user-BDE127 linux-kernel-BDE128PTM136pts180USB189Usb_device245Ext_alarm251Ipmidev252Usb_endpoint253Usbmon254RTC Block Devices:1RAMDisk8SD31Mtdblock65SD66SD67SD68SD69SD70SD71SD128SD129SD130SD131SD132SD133SD134SD135SD [email protected]-a:~#3.7/proc/partitions block allocation information in a partition [email protected]-a-2-1-2:~#cat/proc/partitionsMajor Minor#Blocks name31 0 512mtdblock031 1 512Mtdblock131 2 123904Mtdblock231 3 4096Mtdblock331 4 1024Mtdblock431 5 1024Mtdblock531 6 512Mtdblock631 7 512Mtdblock731 8 123904Mtdblock831 9 4096Mtdblock931 10 1024Mtdblock1031 11 1024mtdblock1131 12 1048576Mtdblock12[email protected]-a-2-1-2:~#3.8/proc/versionlinux kernel version and GCC version [email protected]-a-2-1-2:~#cat/proc/versionLinux version2.6.34.6-wr4.0.0.0_standard ([email protected]) (GCC version 4.4.1 (Wind River Linux sourcery g++ 4.4-291))#1 SMP PREEMPT Fri Nov 16:07:47 CST[email protected]-a-2-1-2:~#3.9/proc/sys/fs/file-Max This file specifies the maximum number of file handles that can be allocated. If the user gets an error message stating that the maximum number of open files has been reached so that they cannot open more files, you may need to increase the value. You can set this value to any number of files, and you can change the value by writing a new numeric value to the file. The default setting is 4096. Change the kernel parameters and redirect to the file with vi edit or echo parameters. #Cat/proc/sys/fs/file-max4096#echo 8192 >/proc/sys/fs/file-max#Cat/proc/sys/fs/file-max8192If the parameters are optimized, they can be written as added to the file rc.local, allowing it to complete the modification automatically when the system starts.
Introduction to/proc directory under Linux system