2014-02-22 16:49:40 -05:00
|
|
|
# tail
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
> Display the last part of a file.
|
2022-01-22 18:06:48 -08:00
|
|
|
> See also: `head`.
|
2025-01-18 18:45:33 +05:30
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/tail-invocation.html>.
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
- Show last 'count' lines in file:
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
`tail --lines {{count}} {{path/to/file}}`
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
- Print a file from a specific line number:
|
2014-03-19 12:49:24 +01:00
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
`tail --lines +{{count}} {{path/to/file}}`
|
2014-03-19 12:49:24 +01:00
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
- Print a specific count of bytes from the end of a given file:
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
`tail --bytes {{count}} {{path/to/file}}`
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2024-02-21 16:22:18 -03:00
|
|
|
- Print the last lines of a given file and keep reading it until `Ctrl + C`:
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
`tail --follow {{path/to/file}}`
|
2017-11-23 17:16:08 -07:00
|
|
|
|
2021-11-07 20:00:19 +01:00
|
|
|
- Keep reading file until `Ctrl + C`, even if the file is inaccessible:
|
2017-11-23 17:16:08 -07:00
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
`tail --retry --follow {{path/to/file}}`
|
2020-07-16 23:49:40 +03:00
|
|
|
|
|
|
|
- Show last 'num' lines in 'file' and refresh every 'n' seconds:
|
|
|
|
|
2022-01-22 18:06:48 -08:00
|
|
|
`tail --lines {{count}} --sleep-interval {{seconds}} --follow {{path/to/file}}`
|