Tailcommand to write the file to standard output starting at the specified point. Using the tail command-The F option provides easy access to the log files that are being changed,Tail-f filename will display the top of the filename in the screen, and not only refresh, so you can see the latest file content.1. command format;Tail[Necessary parameters] [selection parameters] [file]2. Command function: Used to display the end of the specified file, do not specify the file, as input information for processing. Common view log files. 3. Command parameters:-F Loop Read-Q does not display processing information-v displays detailed processing informationNumber of-c< >number of bytes displayed-n< Number of lines >number of rows displayed--pid=pid and-f is shared, which means that the process id,pid dead after the end.-Q,--quiet,--silent never outputs the header of a file name-S,--Sleep-interval=s and-f is shared, which means sleep s seconds at each repetition interval4. Use instance: Instance 1: Show file End content command:Tail-N5log2014.log output: [[email protected] test]#Tail-N5Log2014.log the- the the-Ten the- One the- A==============================[[email protected] test] #说明: Display the last 5 rows of the file instance 2: Loop through the file Contents command:Tail-f test.log output: [[email protected]~]#Ping 192.168.120.204> Test.log &[1]11891[Email protected] ~]#Tail-F test.log PING192.168.120.204(192.168.120.204) About( -) bytes of data. -Bytes from192.168.120.204: icmp_seq=1Ttl= - Time=0.038Ms -Bytes from192.168.120.204: icmp_seq=2Ttl= - Time=0.036Ms -Bytes from192.168.120.204: icmp_seq=3Ttl= - Time=0.033Ms -Bytes from192.168.120.204: icmp_seq=4Ttl= - Time=0.027Ms -Bytes from192.168.120.204: icmp_seq=5Ttl= - Time=0.032Ms -Bytes from192.168.120.204: icmp_seq=6Ttl= - Time=0.026Ms -Bytes from192.168.120.204: icmp_seq=7Ttl= - Time=0.030Ms -Bytes from192.168.120.204: icmp_seq=8Ttl= - Time=0.029Ms -Bytes from192.168.120.204: icmp_seq=9Ttl= - Time=0.044Ms -Bytes from192.168.120.204: icmp_seq=TenTtl= - Time=0.033Ms -Bytes from192.168.120.204: icmp_seq= OneTtl= - Time=0.027Ms[[email protected]~] #说明:Ping 192.168.120.204> Test.log &//Ping the remote host in the background. and output files to Test.log; this practice alsoused for more than one file to monitor. Use CTRL + C to terminate. Example 3: Display the file command starting at line 5th:Tail-N +5log2014.log output: [[email protected] test]#CatLog2014.log the- on the- Geneva the-Geneva the-Geneva the- to the- . the- - the- , the- the the-Ten the- One the- A==============================[email protected] test]#Tail-N +5Log2014.log the- to the- . the- - the- , the- the the-Ten the- One the- A==============================
Linux Command learning Note (tail): command