Common Linux commands (14) and common linux commands

Source: Internet
Author: User

Common Linux commands (14) and common linux commands

The tail command writes 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. The tail content of the filename is displayed on the screen and refreshed continuously, so that you can see the latest file content.


1.Command Format;

Tail [required parameters] [select parameters] [files]


2.Command function:

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: Read cyclically

-Q: no processing information is displayed.

-V: displays detailed processing information.

-C <number> Number of bytes displayed

-N <number of rows> Number of displayed rows

-- Pid = PID and-f are used together to indicate that the process ID ends after the PID dies.

-Q, -- quiet, -- silent never outputs the header of the given file name

-S, -- sleep-interval = S and-f are used together, indicating that the sleep seconds at each repeated interval


4.Instance used:

Instance 1:Display the last five lines of the file

Command: tail-n 5 log2014.log


Example 2:Displays files starting from line 1

Command: tail-n + 5 log2014.log


Example 3:View File Content cyclically

Command: tail-f test. log

Note: ping 192.168.120.204> test. log &

Ping the remote host in the background. And output the file to test. log;

[root@localhost ~]# ping 192.168.120.204 > test.log &[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 from 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






 

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.