tail command syntax

 

A, tail command syntax

tail [-f] [-c Number | -n Number | -m Number | -b Number | -k Number] [File]
of parameters:
-f This parameter is used to monitor File file growth.
-C Number Number reads the specified file from byte position
-n Number Number reads the specified file from the line position.
-m Number Number read from the multi-byte character position specified file, for example, assume that your file includes text, assuming that the -c parameter may result in truncated, but using -m will avoid this problem.
-b Number 512-byte block location indicated by the Number Reads the specified file.
Number -k reads the specified file from 1KB block location indicated Number.
File operations specified destination file name
in the command above, are related to Number, assumption is not specified, the default display 10 lines. Number may be used in front of the sign, which indicates the offset from the top is counted from the end.
tail file to run in the general / usr / bin / less.

Two, tail command uses the example demonstrates methods

1, tail -f filename
Description: Monitor filename end of the file contents (default 10 lines, representing an increase of parameter -n 10), refresh the display on the screen. Exit, press CTRL + C.

2, tail -n 20 filename
Description: displays the last 20 lines filename.

3, tail -r -n 10 filename
Description: reverse last 10 lines of filename.

Added:
with tail functionally similar commands as well:
CAT start from the first row to display file contents.
tac start from the last row to display file contents.
more page display file contents.
less and more similar, but the page forward support
head shows only the first few lines
tail just behind the display lines
n line numbers with the file content
od binary file content display mode

View tomcat log
tail -f catalina.out
you can view hidden under Linux tomcat startup log output, but can only view the last 10 lines, ctrl + c to exit

View a specific day of the log can start with && sh startup.sh tail -f ../logs/catalina.2018-08-29.log

Whether the window is a communication port through which the first window is mounted in a telnet client and telnet 192.168.7.68 8081 in communication with cmd

Guess you like

Origin www.cnblogs.com/logsharing/p/12220872.html