One linux Command every day (15): tail command

Source: Internet
Author: User
Tags touch command


One linux Command every day (15): tail command link: One linux Command every day (1): ls command http://www.bkjia.com/ OS /201210/163049.html#linuxlinuxcommand every day (2): cd command serial (3 ): pwd command Export (4): mkdir command http://www.bkjia.com/ OS /201210/1620.3.html#a linuxcommand every day (5): rm command Export (6): rmdir command http://www.bkjia.com/ OS /201210/164017. Html; one linux Command every day (7): mv command running (8): cp command http://www.bkjia.com/ OS /201210/163164.html#a linuxcommand every day (9): touch command running (10): cat command running (11 ): nl command http://www.bkjia.com/ OS /201211/165990.htmla linuxcommand every day (12): more command http://www.bkjia.com/ OS /201211/165994.htmllinuxcommand every day (13): Less command http://www.bkjia.com/ OS /201211/165998.htmla linuxcommand every day (14): head command http://www.bkjia.com/ OS /201211/166191.html tail command writes files to standard output from a 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. www.2cto.com 1. command Format; tail [required parameters] [select parameters] [files] 2. command: displays the content at the end of a specified file. If no file is specified, it is processed as an input. Common view log files. 3. command parameters: -f loop read-q does not display processing information-v displays detailed processing information-c <number> Number of bytes displayed-n <number of rows> Number of displayed rows-pid = PID and-f in combination, indicates that the process ends after the process ID and PID die. -q, -- quiet, -- silent never outputs the header-s of the given file name. -- sleep-interval = S is used with-f, indicating that sleep seconds are 4 seconds at each repeated interval. run the command "tail-n 5 log2014.log" on instance: instance 1: display the end Of the file. Output: [root @ localhost test] # tail-n 5 log2014.log 2014-092014-102014-112014-12 ================ ============ [root @ localhost test] # description: display the last five lines of the file. Example 2: view the file content cyclically. Command: tail-f test. log output: [root @ loc Alhost ~] # Ping 192.168.120.204> test. log & [1] 11891 [root @ localhost ~] # Tail-f test. log PING 192.168.120.204 (192.168.120.204) 56 (84) bytes of data.64 bytes from 192.168.120.204: icmp_seq = 1 ttl = 64 time = 0.038 ms64 bytes from 192.168.120.204: icmp_seq = 2 ttl = 64 time = 0.036 ms64 bytes from 192.168.120.204: icmp_seq = 3 ttl = 64 time = 0.033 ms64 bytes from 192.168.120.204: icmp_seq = 4 ttl = 64 time = 0.027 ms64 bytes from 192.168.120.204: icmp_seq = 5 ttl = 64 time = 0.032 ms64 bytes fro M 192.168.120.204: icmp_seq = 6 ttl = 64 time = 0.026 ms64 bytes from 192.168.120.204: icmp_seq = 7 ttl = 64 time = 0.030 ms64 bytes from 192.168.120.204: icmp_seq = 8 ttl = 64 time = 0.029 ms64 bytes from 192.168.120.204: icmp_seq = 9 ttl = 64 time = 0.044 ms64 bytes from 192.168.120.204: icmp_seq = 10 ttl = 64 time = 0.033 ms64 bytes from 192.168.120.204: icmp_seq = 11 ttl = 64 time = 0.027 MS [root @ localhost ~] # Note: ping 192.168.120.204> test. log & // ping the remote host in the background. And output the file to test. log. This method is also used for more than one file monitoring. Use Ctrl + c to terminate. Instance 3: display the file command from line 3: tail-n + 5 log2014.log output: [root @ localhost test] # cat log2014.log 2014-012014-022014-032014-042014-052014-062014-072014-082014-092014-102014-12 ==== ============== [root @ localhost test] # tail-n + 5 log2014.log2014-052014- 062014-072014-082014-092014-102014-112014-12 ========================== ===

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.