Linux commands

2018-10-17  本文已影响0人  isepien

Shell command

1. cat

1.1display file content:
cat fileName
1.2copy fileA content to another fileB
cat fileA > fileB
1.3append fileA content to fileB
cat fileA >> fileB

2. grep

2.1search a word in a file
grep "wordToBeSearch" fileName
2.2 indicating the line number
grep -n "wordToBeSearch" fileName

3. tail

3.1 show the last 10 line content
tail -10 fileName
3.2 show the update of last modification of a file
tail -f fileName

4. grep

4.1 find a word in a file
grep "word" fileName

5. curl

5.1 show url content in terminal
curl example.com
5.2 show url content in an output file name fileA
curl -o fileA example.com
curl -O example.com //output content to a file with its original name.

6. wc

word count
6.1 number of lines in fileName
wc -l fileName
6.2 number of words in fileName
wc -w fileName

7. find

walk a file hierarchy
find all file with type .html: find *.html

8. file

determine file type
file file.pdf

上一篇下一篇

猜你喜欢

热点阅读