2014-02-22 16:49:40 -05:00
|
|
|
# tail
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
> Display the last part of a file.
|
2021-04-01 17:54:26 +02:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/tail>.
|
2014-02-22 16:49:40 -05:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Show last 'num' lines in file:
|
2014-02-22 16:49:40 -05:00
|
|
|
|
|
|
|
`tail -n {{num}} {{file}}`
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Show all file since line 'num':
|
2014-03-19 12:49:24 +01:00
|
|
|
|
|
|
|
`tail -n +{{num}} {{file}}`
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Show last 'num' bytes in file:
|
2014-02-22 16:49:40 -05:00
|
|
|
|
|
|
|
`tail -c {{num}} {{file}}`
|
|
|
|
|
2017-04-28 23:34:51 +01:00
|
|
|
- Keep reading file until `Ctrl + C`:
|
2014-02-22 16:49:40 -05:00
|
|
|
|
|
|
|
`tail -f {{file}}`
|
2017-11-23 17:16:08 -07:00
|
|
|
|
2017-11-24 11:41:53 +05:30
|
|
|
- Keep reading file until `Ctrl + C`, even if the file is rotated:
|
2017-11-23 17:16:08 -07:00
|
|
|
|
|
|
|
`tail -F {{file}}`
|
2020-07-16 23:49:40 +03:00
|
|
|
|
|
|
|
- Show last 'num' lines in 'file' and refresh every 'n' seconds:
|
|
|
|
|
|
|
|
`tail -n {{num}} -s {{n}} -f {{file}}`
|