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
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`tail {{[-n|--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
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`tail {{[-n|--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
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`tail {{[-c|--bytes]}} {{count}} {{path/to/file}}`
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
- Print the last lines of a given file and keep reading it until `<Ctrl c>`:
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`tail {{[-f|--follow]}} {{path/to/file}}`
|
2017-11-23 17:16:08 -07:00
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
- Keep reading file until `<Ctrl c>`, even if the file is inaccessible:
|
2017-11-23 17:16:08 -07:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`tail --retry {{[-f|--follow]}} {{path/to/file}}`
|
2020-07-16 23:49:40 +03:00
|
|
|
|
|
|
|
- Show last 'num' lines in 'file' and refresh every 'n' seconds:
|
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`tail {{[-n|--lines]}} {{count}} {{[-s|--sleep-interval]}} {{seconds}} {{[-f|--follow]}} {{path/to/file}}`
|