2025-03-14 21:59:59 -06:00
|
|
|
# tail
|
|
|
|
|
|
|
|
|
|
> Display the last part of a file.
|
|
|
|
|
> See also: `head`.
|
|
|
|
|
> More information: <https://keith.github.io/xcode-man-pages/tail.1.html>.
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Show last 8 lines in file:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`tail -n 8 {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Print a file from a specific line number:
|
|
|
|
|
|
|
|
|
|
`tail -n +{{8}} {{path/to/file}}`
|
|
|
|
|
|
|
|
|
|
- Print a specific count of bytes from the end of a given file:
|
|
|
|
|
|
|
|
|
|
`tail -c {{8}} {{path/to/file}}`
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
- Print the last lines of a given file and keep reading it until `<Ctrl c>`:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`tail -f {{path/to/file}}`
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
- Keep reading file until `<Ctrl c>`, even if the file is inaccessible:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`tail -F {{path/to/file}}`
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Show last `count` lines in a file and refresh every `seconds` seconds:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`tail -n {{count}} -s {{seconds}} -f {{path/to/file}}`
|