Linux viewing tomcat log files

Source: Internet
Author: User

The command is: Tail-f catalina.out

Tail command

Use
Writes the file to standard output, starting at the specified point. Using the-f option of the tail command makes it easy to see the log files that are being changed, TAIL-F filename will display the most up-to-date content on the screen, and not only refresh, so you can view the latest file content.

Grammar
Standard syntax
tail [-f] [-c number |-N number |-M number |-B number |-K number] [File]

To display rows in reverse order
tail [-R] [-N number] [File]

Describe
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 (that is, the keyboard input is displayed). 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 A + (plus sign), 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 a-(minus sign), 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.

The cell type used to determine the starting point of a count is determined by the-B,-C,-K,-M, and-N flags. If no one of these flags is specified, then the tail command reads the last ten lines of the specified file and writes it to standard output. This is the same as entering-N 10 on the command line.

The-m flag provides consistent results in both single-byte and double-byte character environments. Use the-C flag with caution when the input is a text file that contains multibyte characters, because the resulting output may not start with a character boundary.

Sign

-B number
Reads the specified file starting at 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 document parameter specifies a FIFO (first-in, 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
Reads the specified file starting from the multibyte character position represented by the number 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 starting at the line position represented by the number variable.

-R
Displays the output in reverse order from the end of the file. The default value of the-R flag is to print 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.


Exit status
The command returns the following exit values:

0
Completed successfully.

>0
An error occurred.

Example
To display the last ten lines of the notes file, enter:

Tail notes to specify the number of rows to start reading from the end of the Notes file, enter:
Tail-n notes
To start with the No. 200 byte, each time a page of notes files is displayed, enter:
Tail-c +200 Notes | Pg
To track the growth of a file, enter:
Tail-f accounts
This displays the last ten lines of the accounts file. The tail command continues to display lines that are added to the accounts file. The display will continue until you press the CTRL-C key sequence to stop.
File

/usr/bin/tail
Contains the tail command.

Linux viewing tomcat log files

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.