1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-01 23:55:26 +02:00
tldr/pages/common/tail.md

30 lines
885 B
Markdown
Raw Normal View History

2014-02-22 16:49:40 -05:00
# tail
> Display the last part of a file.
2022-01-22 18:06:48 -08:00
> See also: `head`.
> 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
- 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}}`
- Keep reading file until `<Ctrl c>`, even if the file is inaccessible:
2025-03-12 21:05:58 +02:00
`tail --retry {{[-f|--follow]}} {{path/to/file}}`
- 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}}`