Writes a file to standard output, beginning at a specified point.
tail [ -f ] [ -c Number | -n Number | -m Number | -b Number | -k Number ] [ File ]
tail [ -r ] [ -n Number ] [ File ]
The tail command writes the file specified by the File parameter to standard output beginning at a specified point. If no file is specified, standard input is used. The Number variable specifies how many units to write to standard output. The value for the Number variable can be a positive or negative integer. If the value is preceded by + (plus sign), the file is written to standard output starting at the specified number of units from the beginning of the file. If the value is preceded by - (minus sign), the file is written to standard output starting at the specified number of units from the end of the file. If the value is not preceded by + (plus sign) or - (minus sign), the file is read starting at the specified number of units from the end of the file.
The type of unit used by the Number variable to determine the starting point for the count is determined by the -b, -c, -k, -m, or -n flag. If one of these flags is not specified, the tail command reads the last ten lines of the specified file and writes them to standard output. This is the same as entering -n 10 at the command line.
The -m flag provides consistent results in both single- and double-byte character environments. The -c flag should be used with caution when the input is a text file containing multibyte characters, because output can be produced that does not start on a character boundary.
This command returns the
following exit values:
0 | Successful completion. |
>0 | An error occurred. |
tail notes
tail -n 20 notes
/usr/bin/tail | Contains the tail command. |
The dd command, head command, more command, pg command.
Files Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices describes files, file types, and how to name files.
Input and Output Redirection Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices describes how the operating system processes input and output.