1. Create a directory/data
Mkdir/data
CD/; mkdir data
Command summary:
mkdir command to create a directory
LS-L long format display-D directory displays directory or file
CD switch directory hierarchy
2. Create the Aaa.txt file below/data
Pwd
Cd/data;touch Aaa.txt or Touch/data/aaa.txt
3. Adding content to aaa.txt study Linux
echo "Study Linux" >/data/aaa.txt
Vi/vim I study Linux QW
4. Copy the Aaa.txt file to the/temp.
Cp/data/aaa.txt/temp
Parameter-A can be copied directory-pdr
5. Move the/data directory to the/root
mv/data//root/
6. Go to the data directory in the root directory and delete the Aaa.txt
Cd/root/data;rm Aaa.txt y
Rm-f/root/data/aaa.txt
7. Exit to the previous level directory, delete the data directory
CD: Rm-r/data
Paired with Xargs
Find. -type f-mtime +15 |xargs rm-f Delete file 15 days ago Current directory file
Find. -type d-mtime +30 |xargs rm-rf Delete directory 30 days ago directory under current directory
Using the-exec of find
Find/logs-type f-mtime +5-exec rm {} \; Find files that change time before 5th in the/log directory and delete
8. Filtering files
Cat
Grep-v
Grep
9. Create a complete/data/aaa/directory with one command
Mkdir-p/DATA/AAA/B/C/D
tree/data/Display tree structure
10. It is known that the Test.txt file already exists in the/tmp directory, how to execute the command in order to copy the/mnt/test.txt to/tmp and overwrite the/tmp/test.txt, and the Linux system does not prompt to overwrite
/bin/cp/mnt/test.txt/tmp/test.txt
\cp/mnt/test.txt/tmp/test.txt
11. Only the contents of lines 20th through 30th in the Ett.txt file (100 included) are produced.
This article is from the "Small Zheng Technology Blog" blog, please be sure to keep this source http://ko178.blog.51cto.com/220419/1725750
Linux Learning Notes-2015-12-17