Tail

From Unix SME

Command Name

   tail

Description

   Tail is like the other half of the command head. The tail command prints 
   the last N number of lines of data from a specified file. By 
   default, it prints the last 10 lines of the specified files. If more 
   than one file name is provided then data from each file is preceded 
   by its file name.

Syntax and Structure

   tail [OPTION]...[FILE]


Use Case

   Displaying a specified number of lines containing information 
   pertaining to the file that you are looking up. 

Examples

Find the Last 10 Lines on the Local File

  [user@host ~]$ tail /usr/local

Reads the Specified File from the First or Last Line Location

  [user@host ~]$ tail -n [number]

Output Appended Data as the File Grows

  [user@host ~]$ tail -f

Omits the file names from the output, displaying only the contents

  [user@host ~]$ tail -q

Reads Specified File Beginning at the Byte Location

  [user@host ~]$ tail -c [number]

Starts at Line 25 and Reads to the End of the Bob File

  [user@host ~]$ tail +25 /home/bob

Reads the Last 10 Lines of the Two Specified Files

  [user@host ~]$ tail <file1> <file2>

Read Header/Name of the File and Subsequent 10 Lines

  [user@host ~]$ tail -v <file>

Attempts to Open Specified File Should it be Inaccessible

  [user@host ~]$ tail --retry