Linux (3)-basic structure of the file system and basic structure of linux
The Linux File System is a single inverted tree structure with the file name strictly case sensitive (windows systems are case insensitive ). The path is separated by "/", which is different from "\" in windows.
Here I have drawn a normal directory structure of a general Linux system:
A single directory refers to the top-level directory "/". Each of the following directories has the following functions:
Bin: stores commonly used executable binary files (commands ). In the sbin folder, only Super Users (root) can execute boot: boot directory, system boot Startup File. Contains the file starting with the Kernel File vmlinuz. Dev: Device directory, all hardware devices of the computer. Each hardware is abstracted as a file. Etc: configuration files of almost all operating systems. Home: home Directory, document data for all users lib: library file for running the program. Opt: install large software (such as Oracle), not to force proc: system real-time information (this folder does not exist in the hard disk, only in the memory, is a virtual folder) sys: system underlying hardware information tmp: temporary directory, which is automatically deleted every few days: usr: application software installation directory (default installation directory) var: saves frequently changed information (such as system log information)
For Linux systems, each system process (shell) has a current working directory, that is, each process is relative to a working directory. The pwd command displays the current working directory.
In Linux, there is no difference between files and folders. The name is case sensitive and contains a maximum of 255 characters. The forward slash is not a valid character (because it is the path separator number ), you can use the touch command to create a blank file or update the time of an existing file.
Below are some basic file system commands:
Ls command
Ls is used to list contents in the current directory (or add directories like ls/usr. By default, this directory is not added) ls-a displays all files in the current directory (including hidden files (hidden files are usually configuration files )) ls-l display details ls-R recursive display subdirectory structure ls-ld display directory and link information file command View file Type
Cd command to switch DirectoriesUpper-level Directory:... current directory:. user's home directory :~ Previous working directory:-under any directory, the cd carriage returns to the home directory.
File Operations:Create: mkdir create folder touch create empty file or update file time delete: rmdir
Delete empty folderRm file deletion parameters:-I interactive (confirmation is prompted every time a file is deleted)-r recursive Deletion
Non-empty folder-F indicates that all content is forcibly deleted. If no warning is displayed, copy the entire directory tree (Folder copy) to the target file of the cp source file.-v indicates that the detailed information is moved: mv is basically the same as cp. If you do not specify a file name, it is equivalent to cutting. If you specify a name, it is cut and renamed. You can use this to rename the file.