Linux--tail command

Source: Internet
Author: User

Inux Tail command is used in accordance with the requirements of the final part of the specified file output to standard equipment, usually the terminal, popular speaking, is to put the last few lines of a file to the terminal, assuming that the file is updated, tail will voluntarily refresh themselves, to ensure that you see the latest file content.

First, tail command syntax

1.tail [-F] [-c number |-N number |-M number |-B number |-K number] [File]

-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 row position

-m number reads the specified file from the multiple-byte character position (assuming that your file contains text, specifying the-c parameter may cause truncation, but using-m will avoid 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

2.tail [-R] [-N number] [File]

Show rows in reverse order

3. Notes

All of the above commands involve number, which, if not specified, displays 10 rows by default.

Number in front of the + + sign, indicating whether the offset is calculated from the top or the tail

When no marker symbol is in front of number, the default is calculated from the tail

Second, tail command use method demonstration example

1.tail-f filename

Monitor the trailing contents of the filename file (1219.www.qixoo.qixoo.com/default 10 lines, equivalent to add parameter-n 10), refresh the display on the screen

Press CTRL + C to exit

2.tail-n filename

Show FileName last 20 lines

3.tail-n +20 filename

Show filename in front 20 lines

4.tail-r-N-filename

Reverse displays the last 10 lines of the filename

Iii. commands with similar functions as tail

Cat Displays the contents of the archive starting from the first line

The TAC starts displaying the contents of the archive from the last line

More pagination Displays archive content

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

Linux--tail command

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.