Linux Learning: Tail command--monitoring logs

Source: Internet
Author: User

Brief introduction

The Tail command writes the files specified by the file parameter to standard output, starting at the specified point. If no file is specified, standard input is used. The number variable specifies how many cells are written to standard output. The value of the number variable can be a positive or negative integer. If the value is preceded by +, the file is written to standard output starting at the number of cells specified at the beginning of the file. If the value is preceded by-, the file is written to standard output starting at the number of cells specified at the end of the file. If the value is preceded by A + (plus sign) or-(minus sign), the file is read from the unit number specified at the end of the file.  

For example: View Tomcat logs:

Tail-f Catalina.out


Grammar

Tail syntax format: tail [-f] [-c number |-N number |-M number |-B number |-K number] [File] or tail [-r] [ -N number] [File]

-B number starts reading the specified file from the 512-byte block position represented by the number variable.
-C number reads the specified file starting at the byte position represented by the number variable.
- F If the input file is a regular file or if the filename parameter specifies a FIFO (first in, out), then the tail command does not terminate after the last specified unit of the input file is copied, but continues to read and copy additional units from the input file (when those cells are available). If the File parameter is not specified and the standard input is a pipe, the-f flag is ignored. The tail-f command can be used to monitor the growth of files that another process is writing.
-K number reads the specified file starting at the 1KB block position represented by the number variable.
-M number starts reading the specified file from the multibyte character position represented by the # variable. Use this flag to provide consistent results in a single-byte and double-byte character code set environment.
- N Number reads the specified file from the first or last row position, represented by the sign of the number variable (+ or-or none), and is shifted by the Line No.
-R Displays the output in reverse order from the end of the file.   The default value of the-R flag is to display the entire file in reverse order.

if the file is larger than 20,480 bytes, then the-r flag displays only the last 20,480 bytes. The-r flag is valid only with the-n flag. Otherwise, it will be ignored.  

This article is from "I Love Big gold" blog, please be sure to keep this source http://1754966750.blog.51cto.com/7455444/1902068

Linux Learning: Tail command--monitoring logs

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.