tail for Windows Manual

© TriSun Software Limited



Synopsis

tail [-f] [-c|-b|-k|-l|-m|-n [+/-]num] [file]
tail +[num]c|b|k|l|m|n[f] [file]
tail -[num]c|b|k|l|m|n[f] [file]

Description

tail DOS command is used to display last lines of a file.
Calling tail without options will display the last 10 lines of the specified file. This is useful for seeing the most recent entries in log files or any file where new information is appended.

Options

All tail options except -f are mutually exclusive. You can only specify one of them.

tail accepts the following options:

-b [+/-]num>
+/-[num]b
begins displaying the file at a location determined by num. If num is preceded by a minus sign (-)or no sign at all, tail displays the last num blocks of the file. If num is preceded by a plus sign (+), tail displays the file beginning with the numth block. A block is 512 bytes. As a result, -b num is equivalent to -c num x 512.

If num is not specified, tail behaves as if num was 10.

-c [+/-]num
+/-[num]c
is similar to the b option, but num is in bytes rather than blocks.

-f
f
monitors a file as it grows. Every two seconds, tail wakes up and displays any new data at the end of the file. This flag is ignored if reading from the standard input and standard input is a pipe.

-k [+/-]num
+/-[num]k
is similar to the b option, but num is in kilobytes (1024 bytes) rather than blocks. Thus, -k num is equivalent to -c num x 1024.

-l [+/-]num
+/-[num]l
is similar to the b option, but num is in lines rather than blocks.

-m [+/-]num
+/-[num]m
is similar to the b option, but num is in megabytes (1024 x 1024 bytes) rather than blocks. Thus, -m num is equivalent to -c num x 1024 x 1024.

-n [+/-]num
+/-[num]n
is similar to the b option, but num is in lines rather than blocks.

-num
displays the last num lines of the file.

+num
displays the file beginning with its numth line.

Examples

These 4 commands all display the last 10 bytes of a file:

tail -c10 filename
tail -c -10 filename
tail -10c filename
tail -c filename

These 3 commands all display a file beginning with its 10th byte:

tail -c +10 filename
tail +10c filename
tail +c filename

Diagnostics

Possible exit status values are:

0
Successful completion.

1
Failure due to any of the following:

* insufficient memory
* write error on the standard output
* badly formed line or byte count
* missing number after an option
* error re-opening a file descriptor

2
Failure due to an unknown command line option.

Messages Badly formed line/byte count "string"
In an option of the form -n num or -num, the num was not a valid number.

Re-opening file descriptor "num"
-f was used to follow a file as it grows. tail closed the file associated with the given file descriptor num then tried to open it two seconds later. At this point, tail found it could not re-open the file for reading and, therefore, could not follow the file any longer.