HOME

TheInfoList



OR:

is a program available on
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user 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, *nix 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 Uni ...
systems,
FreeDOS FreeDOS (formerly 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 system, legacy software and supporting embedded systems. FreeDOS ca ...
and
MSX-DOS MSX-DOS is a discontinued disk operating system developed by Microsoft's Japan subsidiary for the 8-bit home computer standard MSX, and is a cross between MS-DOS v1.25 and CP/M-80 v2.2. MSX-DOS MSX-DOS and the extended BASIC with 3½-in ...
used to display the tail end of a text file or piped data.


Implementations

The version of bundled in
GNU GNU ( ) is an extensive collection of free software (394 packages ), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operating systems popu ...
coreutils The GNU Core Utilities or coreutils is a collection of GNU software that implements many standard, Unix-based shell commands. The utilities generally provide POSIX compliant interface when the environment variable is set, but otherwise offers ...
was written by Paul Rubin, David MacKenzie, Ian Lance Taylor, and Jim Meyering. The command is available as a separate package for
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
as part of the
UnxUtils UnxUtils is a collection of utility programs that provide popular Unix-based shell commands ported from GNU implementations as native Windows programs that depend only on Win32 and the Microsoft C- runtime ( msvcrt.dll). The collection wa ...
collection of
native Native may refer to: People * '' Jus sanguinis'', nationality by blood * '' Jus soli'', nationality by location of birth * Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory ** Nat ...
Win32 The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
ports Ports collections (or ports trees, or just ports) are the sets of makefiles and Patch (Unix), patches provided by the BSD-based operating systems, FreeBSD, NetBSD, and OpenBSD, as a simple method of installing software or creating binary packages. T ...
of common GNU Unix-like utilities. The
FreeDOS FreeDOS (formerly 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 system, legacy software and supporting embedded systems. FreeDOS ca ...
version was developed by M. Aitchison. A command is also part of
ASCII ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
's ''MSX-DOS2 Tools'' for
MSX-DOS MSX-DOS is a discontinued disk operating system developed by Microsoft's Japan subsidiary for the 8-bit home computer standard MSX, and is a cross between MS-DOS v1.25 and CP/M-80 v2.2. MSX-DOS MSX-DOS and the extended BASIC with 3½-in ...
version 2. ''CCZE'' is -like while displaying its output in color. ''pctail'' is similar to CCZE. It is a colorized programmed in Python which tails and colorizes syslog output. ''Inotail'' was an implementation using the
inotify inotify (inode notify) is a Linux kernel subsystem created by John McCutchan, which monitors changes to the filesystem, and reports those changes to applications. It can be used to automatically update directory views, reload configuration files, ...
Linux kernel interface (introduced in version 2.6.13 in August 2005) to check whether new data is available instead of polling every second, as the original did. However, newer versions of tail also started using inotifiy when possible, so Inotail became deprecated and is not longer maintained. 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 timepiece carried or worn by a person. It is designed to maintain a consistent movement despite the motions caused by the person's activities. A wristwatch is worn around the wrist, attached by a watch strap or another type of ...
, CCZE/pctail,
grep grep is a command-line utility for searching plaintext datasets for lines that match a regular expression. Its name comes from the ed command g/re/p (global regular expression search and print), which has the same effect. grep was originally de ...
,
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 In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
is: tail ptions By default, will output the last 10 lines of its input to the
standard output Standard may refer to: Symbols * Colours, standards and guidons, kinds of military signs * Standard (emblem), a type of a large symbol or emblem used for identification Norms, conventions or requirements * Standard (metrology), an object t ...
. With
command line A command-line interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
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 page A man page (short for manual page) is a form of software documentation found on Unix and Unix-like operating systems. Topics covered include programs, system libraries, system calls, and sometimes local system details. The local host administr ...
s 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 s ...
, 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 collection of GNU software that implements many standard, Unix-based shell commands. The utilities generally provide POSIX compliant interface when the environment variable is set, but otherwise offers a ...
as of version 7.5 support the
inotify inotify (inode notify) is a Linux kernel subsystem created by John McCutchan, which monitors changes to the filesystem, and reports those changes to applications. It can be used to automatically update directory views, reload configuration files, ...
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 timepiece carried or worn by a person. It is designed to maintain a consistent movement despite the motions caused by the person's activities. A wristwatch is worn around the wrist, attached by a watch strap or another type of ...
command can be used. There is a
GNU Emacs GNU Emacs is a text editor and suite of free software tools. Its development began in 1984 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 ...
mode that emulates the functionality of , called .


See also

* head (Unix) *
less (Unix) less is a terminal pager Computer program, program on Unix, Microsoft Windows, 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 al ...
*
List of Unix commands This is a list of the shell commands of the most recent version of the Portable Operating System Interface (POSIX) IEEE Std 1003.1-2024 which is part of the Single UNIX Specification (SUS). These commands are implemented in many shells on moder ...


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