Tham khảo tài liệu 'advanced linux programming: 7-the /proc file system', công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 7 The proc File System TRy INVOKING THE mount COMMAND WITHOUT ARGUMENTS this displays the file systems currently mounted on your GNU Linux ll see one line that looks like this none on proc type proc rw This is the special proc file system. Notice that the first field none indicates that this file system isn t associated with a hardware device such as a disk drive. Instead proc is a window into the running Linux kernel. Files in the proc file system don t correspond to actual files on a physical device. Instead they are magic objects that behave like files but provide access to parameters data structures and statistics in the kernel. The contents of these files are not always fixed blocks of data as ordinary file contents are. Instead they are generated on the fly by the Linux kernel when you read from the can also change the configuration of the running kernel by writing to certain files in the proc file system. Let s look at an example Is -1 proc version -r--r--r-- 1 root root 0 Jan 17 18 09 proc version Note that the file size is zero because the file s contents are generated by the kernel the concept of file size is not applicable. Also if you try this command yourself you ll notice that the modification time on the file is the current time. 148 Chapter 7 The proc File System What s in this file The contents of proc version consist of a string describing the Linux kernel version number. It contains the version information that would be obtained by the uname system call described in Chapter 8 Linux System Calls in Section unarne plus additional information such as the version of the compiler that was used to compile the can read from proc version like you would any other file. For instance an easy way to display its contents is with the cat command. cat proc version Linux version root@ gcc version . 66 19990314 Linux release 1 Tue Mar 7 21 07 39 EST 2000 The various entries