1. Directory with path 1.1 relative path and absolute path:
- Absolute path: The path is written "must be from the root directory/write", for example:/usr/share/doc this directory.
- Relative path: The path is written " not by/write", for example, by/usr/share/doc to the bottom of/usr/share/man, you can write: "CD. /man "This is how the relative path is written!" Relative path means "the path relative to the current working directory!" "
1.2 related operations of the directory:
It is important to note that there are two directories under all directories, each of which is "." and "." Represent the meaning of this layer and the previous level of the directory, respectively. Then consider the following example:
| Example: Under Linux, there is no top-level directory under the root directory (..) Exist? A: If you use "ls-al/" to query, you can see that the root directory does exist. And.. Two directories, and then a closer look, you can find that the properties of these two directories and permissions exactly the same, which represents the root of the previous layer (..) With the root directory itself (.) is the same directory. |
1.2.1 CD Transform Catalog
The CD is the abbreviation for Change directory, which is the command used to transform the working directory. Note that there is a space between the directory name and the CD command.
1.2.2 PWD Displays the current directory
PWD is the abbreviation for print working directory, which is the command that displays the directory that is currently located
1.2.3 mkdir Creating a new directory
1.2.4 rmdir Delete Empty directory
1.3 Variables for running paths: $PATH
" Why can I run the/bin/ls command anywhere?" "Why do I enter LS in any directory to show some information without saying I can't find the/bin/ls command?" This is due to the help of the environment variable PATH!
When we run a command, for example, "LS" is good, the system will follow the path of the configuration of each path defined by the directory to search for the file named LS, if the directory defined in the path contains multiple files named LS to run the file, then the first to search for the same name command is run first!
Now, give the echo $PATH to see what directories are defined? Echo has the meaning of "show, Print," and the $ in front of path indicates that the variable is followed, so the current path is displayed!
2. file and directory management
The management of files and directories is nothing more than "Display Properties", "Copy", "Delete Files" and "Move files or directories" and so on, because the management of files and directories in Linux is very important, especially everyone's own home directory data also need to pay attention to management!
2.1 Viewing of files and directories: LS 2.2 Copy, delete and move: CP, RM, MV 2.2.1 cp (copy files or directories)
Replication (CP) This command is very important, the different identity of the run this command will have different results, especially the-a,-p option, for different identities, the difference is very big!
2.2.2 RM to remove files or directories
2.2.3 MV Moving files and directories, or renaming
Brother Bird's Linux private cuisine Learning-(eight) Linux file and directory management