Command specified number of rows to view the file
tail command (see the end of the file data)
1 # contents of the output end of the file, the default line 10 2 tail date.log . 3 . 4 # content output last 20 rows . 5 tail -20 date.log . 6 . 7 # outputs the penultimate line 20 to the end of the file contents . 8 tail -n - 20 date.log 9 10 11 # output line 20 to the end of the file contents 12 tail -n +20 date.log 13 14 # real-time monitoring file content increased, the default 10 lines. 15 tail -f date.log
head command (see the beginning of the file)
1 # contents of the output at the beginning of the file, the default line 10 2 head date.log . 3 . 4 # SUMMARY beginning of the output line 15 . 5 head -15 date.log . 6 . 7 # contents to the beginning of the output on line 15 . 8 head -n +15 DATE .log . 9 10 # outputs the reciprocal to the content at the beginning of the first row 15 . 11 head -n -15 date.log
sed command
. 1 # Sed -n 'start line, the end line p' File Name 2 . 3 # content output line 70 to line 75 . 4 Sed -n '70 , 75P 'date.log . 5 6 # output line 6, and 260 to 400 rows . 7 Sed -n '6P; 260. , 400P;' file name . 8 . 9 # output line. 5 10 Sed -n filename 5P
According to the contents of the field to find the file
grep command
grep " search string " filename