linux view the log content

linux view the system log file contents:

tail:
tail -f log.log
a few lines to view the file:
1000th line begins to view the 1000 lines
CAT filename | tail -n +1000 | head -n 1000
CAT filename: View the contents of a file
tail -n + x : View from the start line of the file x
head -nx: View the file header rows x

CAT:
. 1, shows the entire file File CAT
2, create a file CAT> File
. 3, the merged file cat file1 file2> file3
parameters:
-n / - Number each line with a line number
-b / - n --noneblock all the non-blank line content with line numbers
--s merge two or more empty conduct a blank line
example:

cat -n file1 > file2
将file1的内容加上行号放到file2
cat -b file1 file2 >> file3
将file1和file2的内容加上行号(空行不加)追加到file3
cat /dev/null > /etc/profile
将profile扔进垃圾箱,并赋予空内容

tac: a cat and command opposite
echo: output for a character
------------------------------------- ------------

Guess you like

Origin www.cnblogs.com/kungFuPander/p/11089815.html