Display the end of files显示文件的结尾部分
The tail command outputs the last part of files. By default, it shows the last 10 lines. The -f (follow) option is particularly powerful for monitoring log files in real-time as new entries are added.
tail命令输出文件的结尾部分。默认情况下,它显示最后10行。-f(follow)选项对于实时监控日志文件特别有用,因为它可以在添加新条目时持续显示。
| Option选项 | Full Name完整名称 | Description描述 | Example示例 |
|---|---|---|---|
-n N |
lines行数 | Print last N lines打印最后N行 | tail -n 5 file.txt |
-f |
follow跟踪 | Output appended data as file grows文件增长时输出追加的数据 | tail -f logfile.txt |
-F |
follow=name跟踪名称 | Follow even if file is rotated即使文件被轮转也跟踪 | tail -F syslog |
-n +N |
skip跳过 | Start from Nth line to end从第N行开始到末尾 | tail -n +10 file.txt |
-c N |
bytes字节 | Print last N bytes打印最后N字节 | tail -c 100 file.txt |
🐕 "tail" = the tail/end of something - Think of a dog's tail at the back!
🐕 "tail" = 某物的尾部/末端 - 想想狗的尾巴在后面!
👀 -f = Follow - Keep following the file like a shadow!
👀 -f = Follow(跟随) - 像影子一样持续跟随文件!
➕ -n +N = Start from N - Positive N means from line N to end
➕ -n +N = 从N开始 - 正N意味着从第N行到末尾