编程知识 cdmana.com

Important directory under Linux

Linux There are some important catalogues, such as /proc, /sys, /SElinux, /bin, /usr/lib, /usr/local, /var, /tmp, What's the meaning behind these catalogues , Through practical exploration , Let's see what they really look like

Kernel version :
 Insert picture description here
Release information
 Insert picture description here

/proc

  Linux The kernel provides a way to /proc When the kernel system is running, the data structure is accessed inside the kernel system , The mechanism for changing kernel settings , proc The file system exists only in memory , It doesn't take up external storage space , It provides the interface for the operation of accessing the system kernel data in the way of file system
   Users and applications can use proc Get information about the system , You can also change some parameters of the kernel , When a user or application reads proc When you file , It dynamically reads the required information from the system kernel and submits

With what I use Linux System as an example , Type in first cd /proc command , Get into /proc Catalog , Reuse ls Command view content
 Insert picture description here
You can see that there are many digital folders , These numbers represent the process number , For example, we write an endless loop process , Then check again /proc The content of , You'll find a folder named after the process number of the process just now
 Insert picture description here
 Insert picture description here
 Insert picture description here
   stay /proc There is also an important directory under the directory : /sys, It's writable , It allows users and processes to access and modify parameters in the kernel ,
 Insert picture description here For example, when we first learned about file descriptors , Use ulimit -a View the maximum number of file descriptors that can be opened , ulimit -n You can change this value , But how many files can be opened , Can be in /proc/sys/fs Under the file-max see ,

Type the command : cat /proc/sys/fs/file-max
 Insert picture description here

/SElinux

  SElinux(Security-Enhanced Linux), Enhanced security Linux, It's a Linux The kernel module , It is mainly used for safety protection , It is designed to meet the needs of users and processes to a minimum , So as to protect the system from loss to the maximum extent
   In one that doesn't use SElinux In the system , The condition of accessing a system resource is whether the user has the right to access it ( read , Write , perform )
   Reuse SElinux In the system , The conditions for accessing a system resource are in addition to the above conditions , And whether a certain type of process has access to a class of resources .
   thus , Even if there are serious losses , It only happens in resources that the process allows access to , Not to lose everything

/bin

  /bin You can see a lot of executable programs in the directory , Knock in ls -l
 Insert picture description here
   Beginners Linux When it comes to basic orders , image ls, rm, mv, cp, echo Common commands like this are executable files , Just so you don't have to knock ./filename To run the , Because of the path where these executable files are stored , Added to the environment variable , The operating system will find the file through the path recorded in the environment variable and execute , You can use ./filename To execute /bin Executable files in directory ,

/usr/lib

  lib It's English library Abbreviation , There is a library , The library means , The library file is saved in this directory

Get into ./gcc Under the table of contents , See what's in it
 Insert picture description here
In the picture .so At the end is the dynamic library file , With .a At the end is the static library file , .o At the end is the binary file to be linked during compilation

/usr/local

Here is the user installed software ,

/var

Here's the login file , Error message file . Log files, etc

/tmp

Here are the temporary files of users and programs running , The system will automatically clean up these files

版权声明
本文为[Ran1366]所创,转载请带上原文链接,感谢

Scroll to Top