tldr/pages/common/tail.md

30 lines
782 B
Markdown
Raw Normal View History

2014-02-22 21:49:40 +00:00
# tail
> Display the last part of a file.
2022-01-23 02:06:48 +00:00
> See also: `head`.
> More information: <https://www.gnu.org/software/coreutils/tail>.
2014-02-22 21:49:40 +00:00
2022-01-23 02:06:48 +00:00
- Show last 'count' lines in file:
2014-02-22 21:49:40 +00:00
2022-01-23 02:06:48 +00:00
`tail --lines {{count}} {{path/to/file}}`
2014-02-22 21:49:40 +00:00
2022-01-23 02:06:48 +00:00
- Print a file from a specific line number:
2014-03-19 11:49:24 +00:00
2022-01-23 02:06:48 +00:00
`tail --lines +{{count}} {{path/to/file}}`
2014-03-19 11:49:24 +00:00
2022-01-23 02:06:48 +00:00
- Print a specific count of bytes from the end of a given file:
2014-02-22 21:49:40 +00:00
2022-01-23 02:06:48 +00:00
`tail --bytes {{count}} {{path/to/file}}`
2014-02-22 21:49:40 +00:00
2022-01-23 02:06:48 +00:00
- Print the last lines of a given file and keep reading file until `Ctrl + C`:
2014-02-22 21:49:40 +00:00
2022-01-23 02:06:48 +00:00
`tail --follow {{path/to/file}}`
2021-11-07 19:00:19 +00:00
- Keep reading file until `Ctrl + C`, even if the file is inaccessible:
2022-01-23 02:06:48 +00:00
`tail --retry --follow {{path/to/file}}`
- Show last 'num' lines in 'file' and refresh every 'n' seconds:
2022-01-23 02:06:48 +00:00
`tail --lines {{count}} --sleep-interval {{seconds}} --follow {{path/to/file}}`