一、把/data目录移动到/root目录里[root @oldboyedu50 ~] # mv /tmp/data /rootmv==move
Frequently-occurring problems:
Ls:cannot access/data:no such file or directory
Second, enter the/root directory/data directory Delete oldboy.txt
To delete a file, first back up
[Root @oldboyedu50 ~] #cd/root/data
[Root @oldboyedu50/data] #cp oldboy.txt Oldboy.txt.lan
Renaming
[Root @oldboyedu50/data] #mv oldboy.txt oldman.txt
Brute Force removal
[Root @oldboyedu50/data] #rm-F/root/data/oldboy.txt
Brute Force Delete Directory
[Root @oldboyedu50/data]# rm-fr/root/data/
Three, find command
Find oldboy.txt file
[rootn @oldboyedu50/data]# find-n/root/data/oldboy.txt
Find a. txt file
[email protected] ~]# find/tmp-type f-name ' *.txt '
find+ pipeline
[[email protected] ~]# find/root-type f-name ' O Ldboy.txt ' |xargs LS
Four, display does not contain "XX" command
1, grep
[[email protected] afeng]# grep ""/tmp/afeng/ygf.txt
[ [email protected] afeng]# grep-v "+"/tmp/afeng/ygf.txt
2, Head/tata
[[email protected] afeng]# head -8/tmp/afeng/ygf.txt
[[email protected] afeng]# tail-3/tmp/afeng/ygf.txt
3, awk
[[email Protected] afeng]# awk '/28/'/tmp/afeng/ygf.txt
[[email protected] afeng]# awk '!/28/'/tmp/afeng/ygf.txt
4. SED
[[email protected] afeng]# sed-n ' 28p '/tmp/afeng/ygf.txt
[[Email protected] afeng]# sed '/28/d '/tmp/afeng/ygf.txt
V. New parameters of mkdir
-P Create multi-level catalogs
Vi. Display of fixed lines
1, Head/tail
[Email protected] afeng]# Head-20/tmp/afeng/ygf.txt |tail-5
2. awk
[Email protected] afeng]# awk ' nr==15,nr==20 '/tmp/afeng/ygf.txt
3. Sed
[Email protected] afeng]# sed-n ' 15,20p '/tmp/afeng/ygf.txt
Linux Operations Lesson five-----Linux