1.find/data/-type f-exec rm-f {} \;
Delete all files under directory/data
2.\ let a meaningful character take off the vest
. Current directory
.. Parent Directory
. Representative point number
3.find/data/-type F|xargs rm-fDelete all files under directory/data
4.| Pipe character, the output of the previous command results to the next program to continue processing
5.find/data-type f! -name "C.txt" |xargs rm-f
Delete all files in the directory, but keep only c.txt
6.find/data-nameFind by name
Find./-type f-name "test.txt"-exec sed-i ' s#bcd#abc#g ' {} \;
replace the BCD characters in the current directory and all test.txt files in the recursive directory with ABC (this method is serial)
Find./-type f-name "test.txt" |xargs sed-i ' s#abc#cba#g 'Replace the ABC characters in the current directory and all test.txt files in the recursive directory with the CBA (this method is serial processing)
Sed-i ' S#cba#bcd#g '
find ./ -type f -name "test.txt"
replace the CBA characters in the current directory and all test.txt files in the recursive directory with BCD (this method is more efficient for parallel processing)
7.! On behalf of "Take the opposite", namely "non" meaning
8.cat >>test.txt<<eof
Test
Liyao
Aa
Eof
9.grepFilter and print, isolate what you want and don't Want (Linux musketeers, good at filtering)
Sed
Stream Editor filter (Linux Three Musketeers, good at fetching rows)
Sed-n '/filtered content/processed commands ' file
-NCancel the default output of SED
-I.
Change the contents of a file
Processed commands: P print printing, d delete delete
grep "AA" Test.txtFilter AA from Test.txt
Sed-n '/aa/p ' test.txt
Filter AA from Test.txt
Grep-v "AA" Test.txtFilter from test.txt except AA
Sed '/aa/d ' test.txt
filter from test.txt except AA
Sed-i ' s#aaa#bbb#g ' test.txtReplace AAA with Bbbbr/>*s often said find and replace, with one string replaced by another
When *g (global) is used in conjunction with S, it represents the replacement of the current row global match
* Here the "#" is the delimiter, can be replaced with/,@,=, etc.
In addition to displaying a matching row, and displaying the n rows before the row
Grep-aIn addition to displaying a matching row, and displaying the n rows after the row
Grep-c
in addition to displaying a matching row, and displaying the rows of n rows before and after
grep "string"-B test.txt
Sed-n ' 20,30p ' test.txtView the contents of line 20th to 30th in the Test.txt file (easy-to-use and efficient method)
Awk
a language that can filter content (Fetch columns), print content, delete content (Linux musketeers, good at fetching columns)
awk ' {print $} ' fileThe first column, the second column, $NF the last column, $ (NF-1) the penultimate column
Awk-f ":" ' {print $} '/etc/passwd
Print first column,-F custom delimiter
Awk-f ":" ' {print $ '-"$"-"$ $} '/etc/passwdPrint first column-second column-third column
awk ' {if (nr<31 && nr>19) print ' \ n '} ' test.txt
Print the contents of line 20th to 30th in the Test.txt file (NR stands for line number,&& and \ n returns to newline)
10.ctrl+cForce interrupt execution of the program, terminate the process
CTRL + Z</em>
Suspends the current program and suspends execution of the program. With the BG and FG commands to switch between the front and rear stations, the FG command restarts the interrupted task in the foreground, and the BG command places the interrupted task in the background execution.
Ctrl+dInstead of sending a signal, it represents a special binary value that represents EOF; in the shell, Ctrl-d represents the launch of the current shell, such as when you return from admin root to your normal user.
11.head
fetch n rows at the beginning of the file, the default is the first 10 rows
Head-n 3Take the first three lines
Head-3
take the first three lines
TailTake the n rows at the end of the file, and the default is 10 lines at the end
Tail-n 3
Take the end propelled
Tail-3Take the end propelled
Tail-f Test.txt
track real-time changes in a file's trailer
head-30 test.txt |tail-11View the contents of line 20th to 30th in the Test.txt file
12.mkdir-p/ROOT/DATA/AA
- p stands for recursive creation of directories
13.yumLinux Package Manager (download package and then call RPM command install package)
Yum Install Tree-y
Download Install tree
RPM-IVH (-i install,-v display output,-H to human readable display)
RPM-IVH package name. RPM (pre-download good)The biggest problem, the dependency problem is not solved, Yum helps to solve the dependency problem
Rpm-qa Tree
Query Tree This package (-Q query,-a All)
14.treeShow directory tree structure
15./bin/cp/mnt/test.txt/tmp/
\cp/mnt/test.txt/tmp/
cp = ' Cp-i '
16.alias
View and define aliases
Aa= ' echo ' I am AA Linux. "'
Alias rm= ' echo ' RM can not is USED,PLS use MV "'
To modify aliases: VI ~/.BASHRC
Valid for all users: VI/ETC/BASHRC or/etc/profile
Entry into force: SOURCE/ETC/BASHRC or/etc/profile
UnaliasRemove alias pwd
17.seq
sequence Sequence
seq [OPTION] ... Last
seq [OPTION] ... First Last
seq [OPTION] ... First INCREMENT Last
Seq-s "Custom delimiter"-S self-setting a separator for landscape display
Linux Learning---Day04