The tail of Linux commands

Source: Internet
Author: User

This article describes how to use the Linux Tail command.
The use of the Linux Tail command is to output the last part of the specified file to a standard device, usually a terminal, in layman's terms, to display the last few lines of an archive file to the terminal, assuming that the file is updated and tail will refresh itself to ensure that you see the latest file content.

First, tail command syntax

tail [-f] [-c number |-N number |-M number |-B number |-K number] [File]
Parameter explanation:
-F This parameter is used to monitor file growth.
-c number reads the specified file from the number byte location
-N number reads the specified file from the number line position.
-m number reads the specified file from the multiple-byte character position, for example, if your file assumes that you include Chinese characters, it is assumed that specifying the-c parameter may result in truncation, but using-m avoids the problem.
-B number reads the specified file from the 512-byte block position represented by number.
-K number reads the specified file from the 1KB block position represented by number.
file specifies the object name of the operation
In the above command, the number is involved, assuming that it is not specified, 10 rows are displayed by default. Number is preceded by a sign that indicates whether the offset is calculated from the top or from the tail.
Tail can run files are generally below/usr/bin/.

Second, tail command use method demonstration example

1. Tail-f filename
Description: Monitors the trailing contents of the filename file (the default 10 lines, which is equivalent to increasing the parameter-n 10), and refreshes the display on the screen. Exit, press CTRL + C.

2. Tail-n filename
Description: Displays the last 20 lines of the filename.

3. Tail-r-N-ten filename
Description: The last 10 lines of filename are displayed in reverse order.

Add:
Commands similar to the tail feature are:
Cat starts displaying the contents of the archive from the first line.
The TAC starts by displaying the contents of the archive from the last line.
More paging displays the contents of the archive.
Less is similar to more but supports page forward
Head only shows the previous lines
Tail only shows the following lines
N Show file contents with line number
OD Displays the contents of the file in binary mode

The tail of Linux commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.