The tail
command is used to display the content at the end of the file, which corresponds to the head
command. When no parameter is connected, the last 10 lines of the specified file will be displayed on the screen by default.
Syntax format: tail [parameter]
Common parameters:
Example
# 默认显示tail test.txt # 显示文件的最后20行tail -n 20 test.txt # 显示文件的最后20个字符tail -c 20 test.txt # 显示从第20行到结尾的内容tail +20 test.txt # 同时显示多个文件,内容之间会显示所属文件名tail test1.txt test2.txt test3.txt # 如果是一个不断更新的文件,像日志,可以指定每次显示文件的最后几行,方便查看tail -f 20 test.txt
This article is reprinted from https://xugaoxiang.com/2022/06/04/linux-cmds-16-tail/
This site is for inclusion only, and the copyright belongs to the original author.