Purpose: write the file to the standard output from the specified point. You can use the-f option of the tail command to conveniently check the changing log file. tail-ffilename will display the tail content in filename on the screen and not only refresh, so that you can see the latest file content. The standard syntax ta... is used to write files to the standard output from the specified point. You can use the-f option of the tail command to conveniently check the changing log file. the tail content of the filename is displayed on the screen and refreshed, so that you can see the latest file content.
Standard syntax: tail [-f] [-c Number |-n Number |-m Number |-B Number |-k Number] [File] www.2cto.com [- r] [-n Number] [File] description the tail command writes the File specified by the File parameter to the standard output starting from the specified point. If no file is specified, standard input is used. The Number variable specifies the Number of units to be written to the 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 the standard output starting from the number of units specified at the beginning of the file. If there is a minus sign before the value, the file is written to the standard output starting from the number of units specified at the end of the file. If no + (plus sign) or-(minus sign) exists before the value, read the file starting from the specified unit number at the end of the file.
The Number variable determines the unit type of the start point of the count by The-B,-c,-k,-m, and-n flags. If no flag is specified, the tail command reads the last 10 lines of the specified file and writes it to the standard output. This is the same as entering-n 10 in the command line. The-m flag provides consistent results in the single-byte and double-byte character environments. When the input is a text file containing multi-byte characters, use the-c flag with caution, because the output may not start from the character boundary. Mark-B Number reads the specified file from the location of the 512-byte block indicated by the Number variable. -C Number www.2cto.com reads the specified file from the byte location indicated by the Number variable. -F if the input File is a regular File or if the File parameter specifies FIFO (first-in-first-out), the tail command will not terminate after the last specified unit of the input File is copied, instead, read and copy additional units from the input file (when these units 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 being written by another process. -K Number reads the specified file from the 1KB block location indicated by the Number variable. -M Number reads the specified file from the multi-byte character position indicated by the Number variable. Use this flag to provide consistent results in the single-byte and double-character code set environments. -N Number: reads the specified file from the row location indicated 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, the-r flag only displays the last 20,480 bytes. The-r flag is valid only when it is used together with the-n flag. Otherwise, it will be ignored. Exit status the Command returns the following exit values: 0 successfully completed. An error occurs at www.2cto.com> 0. The example shows the last 10 lines of the notes file. input: tail notes specifies the number of lines to be read from the end of the notes file. input: tail-n 20 notes starts from 200th bytes, each time a page of notes files is displayed, enter: tail-c + 200 notes | pg to track the file growth, enter: tail-f accounts this shows the last 10 lines of the accounts file. The tail command continues to display the rows added to the accounts file. The display continues until you press Ctrl-C to stop. The file/usr/bin/tail contains the tail command.
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