utility

tail

Output the final NUMBER lines for a positive count. Following growing files is a separate mode with lifecycle and rotation considerations. Example reads a completed file.

Formal Syntax & Structure

bash syntaxbash
tail -n NUMBER [FILE]...

Parameters & Attributes

NameTypeDescription
NUMBERintegerPositive line count

Return Value

exit status

Output the final NUMBER lines for a positive count. Following growing files is a separate mode with lifecycle and rotation considerations. Example reads a completed file.

Working Example

Example Snippetbash
set -o pipefailprintf '%s\n' alpha beta gamma | tee records.txt | wc -lhead -n 1 records.txttail -n 1 records.txt
Bash Reference