File operations in linux are important. understanding file-related knowledge is helpful for the subsequent setup of the lamp development environment, FILE-related commands are commonly used. the following 13 commands are used to learn about the usage of these commands from a simple start. 1. when creating or modifying a file
File operations in linux are important. understanding file-related knowledge is helpful for the subsequent setup of the lamp development environment. The following are commonly used file-related commands:
The following describes the usage of these commands from a simple start.
1. file creation or modification time
This command is simple: touch file name. if the file exists, it is used to modify the file time. if the file does not exist, the file is created.
2. file viewing command
The command is the cat file name. The effect is as follows:
If you want to view the file content in reverse order, use the tac file name, as shown in:
3. delete files or folders VcD4KPHA + yb6z/c7EvP678tXfzsS8/release + LXIgICDJvrP9zsS8/release + s/release/export + cq + o7o8L3A + export = "http://www.2cto.com/uploadfile/Collfiles/20131220/2013122015573732.jpg" width = "700 height =" 464 "alt =" \ ">
This command also has a command named rmdir which can only delete empty folders. this command has a common parameter
-P recursive deletion
4. create a folder
You can directly use the mkdir folder name to create only one layer of folders. if you create multiple layers of folders together, you need to use-p. this parameter indicates recursive folder creation and a parameter-m indicates permission creation.
5. move files
The linux Mobile file actually has three meanings: the mv command can be used to move, cut, and rename the file. this command has a parameter-v, which is used as follows:
6. File statistics
Sometimes we may need to count the number of lines, characters, and words in the file. in this case, the wc command reflects its value, this command has three frequently used options.
-C: number of statistical characters
-L number of statistics rows
-W count words
Let's take a look at these usage methods, as shown in:
7. search for special content
The simple function is to complete character search. the command is grep, which has the following common options:
-N: Display the row number
-C: Display the matching quantity
-I is case insensitive.
The usage is shown in:
8. change file or folder permissions
To implement such a function, you only need to use chmod.
-R recursively changes (the subsequent permissions are as follows: 777)
As shown in:
9. modify the file owner
10. modify the file Group
This command is followed by chgrp and can also have the-R option, which also indicates recursive modification, as shown in:
11. File Replication
You can directly use the cp command to copy files. The command has the following three common options:
-R: copy a folder
-P: keep original file attributes
-V display progress
The commonly used File operation commands are similar. if you need them, you can go to the Internet to find some information.