We know that the Linux file system is a tree structure, at the top of the '/' directory, the root directory below is the other directory, and these directories can have more than one subdirectory, so that a layer of a layer of the formation of a tree structure diagram. Is that what we need to find a file to look down from the root directory? Of course not, here I will introduce two ways of path: relative path and absolute path.
What is a relative path and an absolute path?
Absolute path: The search from the '/' root to the next level, until the end of the line.
Relative path: The route through which the destination is located relative to the current position.
Creation of a directory
mkdir: Used to create a directory
Syntax format: mkdir [option] Dir
-P: Multiple directories and subdirectories can be created at one time
-V: Show the process of creation
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/2D/15/wKiom1OTBibwUgidAAHwLss6de0490.jpg "title=" Mkdir.png "alt=" Wkiom1otbibwugidaahwlss6de0490.jpg "/>
Directory of * * *
RMDIR: Only * * * Empty directory
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/2D/15/wKioL1OTBvPCnYPIAABxKSXF2Ls582.jpg "title=" Rmdir.png "alt=" Wkiol1otbvpcnypiaabxksxf2ls582.jpg "/>
Management of files
Let's start by describing the naming rules for files
1, the length can not exceed 255 characters
2. Cannot use/when file name
3. Strictly case-sensitive
Creation of files
Touch: Can create a file or change the timestamp of a file
Touch file: Used to create an empty file
Timestamp: The number of seconds elapsed from 1970-01-01 00:00:00 to the current time;
Touch-a file: Modify the last access time of the files (example below)
-M file: Modification time of files changed
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/2D/15/wKiom1OTCzzCYjO7AAIXbmXjndI903.jpg "title=" Touch.png "alt=" Wkiom1otczzcyjo7aaixbmxjndi903.jpg "/>
The stat command here is used to view the file type.
The three types of file time will be introduced later.
***rm of the file
Syntax format RM [option] FILE
-I: interactive operation, the popular saying is * * * when reminded whether * * *
-F: No reminder when forcing ***,***
-R: Recursive * * * This directory and all its subdirectories and files
\RM File: Instead of using aliases, use the original command itself (which can be understood as invalid aliases)
Copy of File CP
CP SRC DEST
Description: When there are multiple source files, the dest must be a directory
When the source file is a directory, dest must be a directory
When the source file is a normal file, if the destination file does not exist, the destination file is overwritten and the file is renamed
When the source file is a normal file, if the destination file exists and is a normal file, the destination file is overwritten and the text
Rename the item.
If the destination file is a directory, the source file is assigned to that directory (regardless of the source file)
Syntax format: CP [option] SRC DEST
-r,-r: Recursively replicate this directory and all subdirectories and files in that directory
-F: Strength to copy, not to prompt
-I: interactive operation, giving hints
-P: Permission to retain files while copying, belong to the main group, timestamp
-A: Preserves all attributes of a file, archives replication, often used for backup
-D: Keep links when copying
-P: Keep links when copying
-L: Copy link instead of file pointed to by this link
Moving MV for files
Syntax format MV [option] SRC DEST
Description: The destination file can only be one, and when the destination file is a directory, the source file is moved to that directory.
When the target file is a normal file, the source file must be a normal file, the destination file will be overwritten, and renamed.
If the destination file does not exist, create the
Complete file Rename if source and destination files are again under the same path
-I: Interactive operation
-F: Forced override
-T DIR SRC: Move the source file to the target directory
Note: A syntax for creating directories and copying files is described here
install-d dir: Used to create a directory
Install SRC DEST: For copying files (cannot copy directories)
-M: Specify Permissions
-T DIR SRC: Copy multiple source files to this directory (normal file replication only)
This article from the "Linux Learning Path" blog, declined reprint!