tail

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 24 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tail implements the tail utility.

It copies the last part of each given file to the standard output, starting at the point given by the -n or -c options, defaulting to the last 10 lines. When more than one operand is given, a "==> name <==" header precedes the output of each file; -q and -v make the headers never or always printed. The standard input is used when no operand is given, and also when the operand is "-". With -f, or --follow=name with --retry, as with -F, the inputs keep being copied as further data becomes available: by descriptor, which keeps reading the open files, or by name, which also reopens them when replaced or removed, reporting truncations and printing a header whenever the output comes from a different file. The --pid, -s and --max-unchanged-stats options tune the waiting: tail exits once all the given processes no longer exist, waits a given number of seconds between iterations, and rechecks a name after a given number of unchanged ones. The obsolete first-operand forms tail -NUM and tail +NUM, with an optional b, c or l size letter and a trailing f, are accepted too.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns a new Prog.

Types

type Prog

type Prog struct {
	*coreutils.Runtime
}

Prog is the tail core utility.

func (*Prog) Run

func (p *Prog) Run(ctx context.Context, args ...string) error

Run writes the designated part of the given files to the standard output, in the same order the operands are given. The standard input is used when no operands are given, and also when an operand is "-". With -f, the inputs keep being copied as further data becomes available, and Run only returns once ctx is done, all the writers given with --pid no longer exist, or every followed name is given up. A failing file doesn't stop the others.

Reading is interrupted when ctx is done, and the context error is returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL