System File Management
a Linux system architecture
The difference between a Linux system and a Windows system is superficially similar to the iOS operating system and Android, where the storage of Linux systems is based on the root directory, which is different from the Windows system's sub-disk. In Linux, everything exists in the form of files, so the first thing to know about Linux is the system architecture:
Linux is an inverted tree structure, all the files are in the top-level directory of the system, that is, the root directory "/", and the "/" under the two-level directory is the system installed when the system itself, and these two-level directories have the corresponding function:
/bin Storing binary executables (System commands)
/sbin System Management Command storage location
/boot boot partition, responsible for system boot
/dev Device Management files
/etc most system administration files
Home directory for normal users
/lib 32-bit system library file storage location
/LIB64 64-bit system library file storage location
/media System temporary Device mount point
/MNT System temporary Device mount point
/run System temporary Device mount point
/OPT third-party software installation location
/proc System Information
/root Super User home Directory
/stv/var System Data
/sys System Management (about the kernel)
/tmp system temporary file storage location
/usr System user-related information data and user-defined software storage location
two addressing of files
Absolute path: file in the real location of the system , the file name begins with "/"
relative path: The name of the file relative to the current location of the shorthand , which does not start with/, and the name will automatically add the PWD display value
three management of files
1.touch creating files or modifying file timestamps
Touch File Creation File
2.mkdir Creating a Directory
mkdir Directory Creation
-P Parent Directory does not exist automatically established
3.RM Deleting a directory or file
Rm
-F forcibly removed without prompting
-R Delete Directory
4.cat|head|tail viewing the contents of a file
Cat|head|tail File Content View command
Edit files in 5.vim text mode
Vim filename enters the command mode
Command mode cannot edit the file if you want to edit the file to enter insert mode
Press "I" to enter insert mode
If you are finished editing , press "ESC" to eject the insert mode and enter ": Wq" to save the exit
Vim filename If the file name does not exist, it will be automatically created Vim no action object opened directly, after editing the file to: Wq filename
6.CD Switch Working directory
CD directory switch working directory to the specified directory
CD-Switch working directory to previous directory
CD ~ Switch to your home directory
CD ~usernmae switch to the specified user home directory
Cd.. Go to the parent directory of the current directory
7.ls listing directory or file information
LS direcory|filename list file or directory contents
ls-d direcotry List the directory itself
Ls-l Filename|dorectory lists the properties of the contents of a file or directory
Ls-ld directory lists the properties of the catalog itself
LS-A displays all content in the directory, including the "." Hidden files at the beginning
Ls-r to display content in a directory
LS If there is no target behind then the default target is the current directory
8.CP file copy
CP is the process of creating a new file
CP file File1 file2. directory to copy file File1 file2 to Directory
CP file test establishes the test file template
Cp-r Directory Direcotry1 Replicating directories
9.MV Move or rename,
the MV of the same disk is renamed, and the MV of different disks is the copy-delete process
MV file file1 direcotry move file file1 into directory
MV presence file does not exist file rename file
MV Westos/linux. Move Linux in Westos to the current directory. Represents the current directory
Four Regular expressions
* Match 0 to any character
? Match a single character
[[: Alpha:]] matches a single letter
[[: Lower:]] matches a single lowercase letter
[[: Upper:]] matches a single uppercase letter
[[:d Igit:]] matches a single number
[[: Alnum:]] matches a single number or letter
[[:p UNCT:]] match a single symbol
[[: Space:]] match a single space
{} indicates a nonexistent or existing
{1..9} 1-9
{A.. F} a-f
{1,3,5} 135
{A,c,e} a C E
{1..3} {A.. C} 1a 2a 3a 2a 2b 2c 3a 3b 3c
[] Indicates the existence of the
[A-c] AA BB CC
[a-c] AA or BB or C
[1-3] 1 or 2 or 3
[145] 1 or 4 or 5
[^abc]| [!ABC] except A and B and besides c~ # # #当前用户家目录
~username The specified user home directory
~+ current Directory
~-Directory before current directory
. Current directory
.. Upper level of current directory
This article from "12147236" blog, declined reprint!
Linux rookie Beginner's knowledge of Linux systems