HOME

TheInfoList



OR:

tail is a program available on
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
,
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems,
FreeDOS FreeDOS (formerly Free-DOS and PD-DOS) is a free software operating system for IBM PC compatible computers. It intends to provide a complete MS-DOS-compatible environment for running legacy software and supporting embedded systems. FreeDOS ca ...
and
MSX-DOS MSX-DOS is a discontinued disk operating system developed by Microsoft for the 8-bit home computer standard MSX, and is a cross between MS-DOS 1.25 and CP/M-80 2. MSX-DOS MSX-DOS and the extended BASIC with 3½-inch floppy disk support ...
used to display the tail end of a text file or
pipe Pipe(s), PIPE(S) or piping may refer to: Objects * Pipe (fluid conveyance), a hollow cylinder following certain dimension rules ** Piping, the use of pipes in industry * Smoking pipe ** Tobacco pipe * Half-pipe and quarter pipe, semi-circul ...
d data.


Implementations

The version of tail bundled in
GNU GNU () is an extensive collection of free software Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any ...
coreutils The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were c ...
was written by Paul Rubin, David MacKenzie, Ian Lance Taylor, and Jim Meyering. The command is available as a separate package for Microsoft Windows as part of the
UnxUtils UnxUtils is a collection of ports of common GNU Unix-like utilities to native Win32, with executables only depending on the Microsoft C- runtime msvcrt.dll. The collection was last updated externally on April 15, 2003, by Karl M. Syring. ...
collection of
native Native may refer to: People * Jus soli, citizenship by right of birth * Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory ** Native Americans (disambiguation) In arts and enterta ...
Win32 The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations ...
ports A port is a maritime facility comprising one or more wharves or loading areas, where ships load and discharge cargo and passengers. Although usually situated on a sea coast or estuary, ports can also be found far inland, such as Ha ...
of common GNU Unix-like utilities. The
FreeDOS FreeDOS (formerly Free-DOS and PD-DOS) is a free software operating system for IBM PC compatible computers. It intends to provide a complete MS-DOS-compatible environment for running legacy software and supporting embedded systems. FreeDOS ca ...
version was developed by M. Aitchison. A tail command is also part of
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because ...
's ''MSX-DOS2 Tools'' for
MSX-DOS MSX-DOS is a discontinued disk operating system developed by Microsoft for the 8-bit home computer standard MSX, and is a cross between MS-DOS 1.25 and CP/M-80 2. MSX-DOS MSX-DOS and the extended BASIC with 3½-inch floppy disk support ...
version 2. ''CCZE'' is tail-like while displaying its output in color. ''pctail'' is similar to CCZE. It is a colorized tail programmed in Python which tails and colorizes syslog output. ''Inotail'' is a deprecated implementation of inotify kernel interface. The early implementation of tail polled every second to see if new data can be displayed, as tail implemented inotifiy kernel interface Inotail become deprecated and it is not longer maintained. Inotail used the
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine lea ...
's inotify-interface introduced in version 2.6.13 in August 2005 so that it only checks for new data when there really is some. MultiTail not only displays logfiles in colors, it can also merge, filter, scrollback and split a terminal window into subwindows. It is more or less a combination of tail, sed,
watch A watch is a portable timepiece intended to be carried or worn by a person. It is designed to keep a consistent movement despite the motions caused by the person's activities. A wristwatch is designed to be worn around the wrist, attached ...
, CCZE/pctail,
grep grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. Its name comes from the ed command ''g/re/p'' (''globally search for a regular expression and print matching lines''), which has the sa ...
,
diff In computing, the utility diff is a data comparison tool that computes and displays the differences between the contents of files. Unlike edit distance notions used for other purposes, diff is line-oriented rather than character-oriented, but i ...
, Beeper and others.


Syntax

The command- syntax is: tail ptions By default, will output the last 10 lines of its input to the standard output. With
command line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
options, the amount of output and the units (lines, blocks or bytes) may be changed. In the following example only the last line of the reports is output: $ tail -n1 report-13*


> report-1301 <

Total tons output for month of January '13 was 523


> report-1302 <

Total tons output for month of February '13 was 272


> report-1303 <

Total tons output for month of March '13 was 623
This example outputs the last 4 characters of the reports, silently suppressing the filenames. Notice that the count includes the newline character at the end of each line and so the output does not include a leading space one might expect. $ tail --silent -c4 report* 523 272 623 This example shows all lines of report from the second line onwards: tail -n +2 report Using an older syntax (still used in older version of Sun Solaris as the -n option is not supported), the last 20 lines and the last 50 bytes of ''filename'' can be shown with the following command: tail -20 ''filename'' tail -50c ''filename'' However this syntax is now obsolete and does not conform with the POSIX 1003.1-2001 standard. Even if still supported in current versions, when used with other options (like -f, see below), these switches could not work at all. As with all Unix commands, use man pages on the running system for specific options and actions.


File monitoring

has two special command line option and (follow) that allows a file to be monitored. Instead of just displaying the last few lines and exiting, displays the lines and then monitors the file. As new lines are added to the file by another
process A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management *Business process, activities that produce a specific se ...
, updates the display. This is particularly useful for monitoring log files. Ancient versions of tail poll the file every second by default but tail from the
GNU coreutils The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were cr ...
as of version 7.5 support the inotify infrastructure introduced in Linux kernel version 2.6.13 in August 2005 which only check the file when is notified of changes by the kernel. The following command will display the last 10 lines of ''messages'' and append new lines to the display as new lines are added to ''messages'': tail -f /var/adm/messages To keep following the log even when it is recreated, renamed, or removed as part of log rotation, at least BSD and GNU implementations provide a option which is useful in cases when the user is following a log file that rotates. tail -F /var/adm/messages To interrupt while it is monitoring, break-in with Ctrl+C. This command can be run "in the background" with , see job control. If the user has a command's result to monitor, the
watch A watch is a portable timepiece intended to be carried or worn by a person. It is designed to keep a consistent movement despite the motions caused by the person's activities. A wristwatch is designed to be worn around the wrist, attached ...
command can be used. There is a
GNU Emacs GNU Emacs is a free software text editor. It was created by GNU Project founder Richard Stallman, based on the Emacs editor developed for Unix operating systems. GNU Emacs has been a central component of the GNU project and a flagship proje ...
mode that emulates the functionality of , called .


See also

* head (Unix) *
less (Unix) less is a terminal pager program on Unix, Windows, and Unix-like systems used to view (but not change) the contents of a text file one screen at a time. It is similar to , but has the extended capability of allowing both forward and backward na ...
*
List of Unix commands This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems. List See also * List of G ...


References


External links


GNU Project documentation for tail
* * {{Core Utilities commands Unix SUS2008 utilities Unix text processing utilities Plan 9 commands Inferno (operating system) commands IBM i Qshell commands