One Linux command per day (--tail) command

Source: Internet
Author: User

The tail command writes the file to standard output starting at the specified point. With the-f option of the tail command, you can easily see the log files that are being changed, TAIL-F filename will display the most up-to-date content on the screen, and constantly refresh, you are seeing the latest file content. can be used as monitoring or viewing status and so on.

1. Command format:

tail [Required Parameters] [select parameters] [file]

2. Command function:

Used to display the content at the end of the specified file, and is processed as input when the file is not specified. Common view log files.

3. Command parameters:

-F Loop Read

-Q does not display processing information

-V displays detailed processing information

Number of-c< > bytes displayed

-n< lines > Display rows

--pid=pid and-F, which means it ends after the process id,pid dead.

-S--sleep-interval=s is combined with-F to indicate sleep s seconds at each repetition interval

-Q--quiet--silent never output the header of the file name

4. Usage examples:

Example 1: Displaying the end of a file

Command:

Tail-n 5 Log.txt Display the last 5 lines of the file

Example 2: Looping through the contents of a file

Command:

Tail-f Log.txt

Ping 192.168.0.1 > Ping.log &//Ping remote host in background and output to file Ping.log; This technique can be used for more than one profile monitoring. Use CTRL + C to terminate.

Example 3: Displaying a file starting from line 5th

Command:

Tail-n +5 Log.txt

<end>

The end of the first learning task: The file directory Operations command. Just today Saturday, hey, tonight is going to have a good meal.

One Linux command per day (--tail) command

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.