(1) File and directory operations
Linux can support file names of up to 256 characters, and file names are case-sensitive. "abc" and "ABC" represent different files.
If you are smart, please guess what the type of the file below is?
Answer: Pipe files, ordinary files, link files, device files, and directory files.
(2) Directory structure
These directories are explained on Linux systems as follows:
Table of contents | use |
/bin | Binary files that store commonly used commands. |
/boot | Contains core files necessary for booting Linux. |
/dev | Represents Device (Device), which contains the system's external devices. |
/etc | Mainly stores system configuration files. |
/home | The user's home directory, each user has its own subdirectory. |
/lib | Placed here is the system's dynamic link shared library, which is similar to the Windows DLL. |
/lost+found | A directory that may be used to store recovered files after the system shuts down unexpectedly. |
/mnt | Used for users to temporarily mount other file systems. |
/media | Devices automatically detected by the system, such as USB flash drives, CD-ROMs, etc., will be mounted here. |
/opt | Used to store additional installed software. |
/proc | A pseudo file system that reflects the state of the kernel and stores special files of the current kernel running state. |
/root | The home directory of the system administrator or superuser. |
/sbin | Stores management programs used by super users. |
/selinux | Contains files related to Selinux security mechanisms, specific to certain distributions. |
/sys | A file system that reflects the device state of Linux kernels since version 2.6. |
/usr | Stores shared resources such as application files and data. |
/usr/bin | Stores applications used by system users. /usr/sbin stores advanced management programs used by super users. |
/usr/src | The default location for storing kernel source code. |
/tmp | Used to store temporary files. |
/srv | Store the data that needs to be accessed after the service is running. |
/was | Contains frequently changing content, such as log files. |
/run | Stores information since system startup and is usually cleared when the system restarts. |
Several particularly important directories:
/etc: The location of important configuration files.
/bin, /sbin, /usr/bin, /usr/sbin: Contains system commands. Among them, /bin and /usr/bin are used by all users, while /sbin and /usr/sbin are used by the root user.
/var: Stores logs and other data that may change during runtime.
For the stability and security of the system, users need to be particularly careful to avoid deleting or changing files in these directories at will.