Linux Command-tail command

Source: Internet
Author: User

The tail command is also a very common command for file viewing classes, and today we will introduce you to the use of the Linux Tail command.

For more information on Linux commands, see: Linux Command Quick check manual

The Linux Tail command is primarily used to write files to standard output starting at the specified point. Many people like to use Tail–f to monitor log files.

First, the Linux Tail command format

The Linux Tail command format is as follows

tail [OPTION] ... [FILE] ...

The Linux Tail command parameters are as follows

-F Loop Read-Q does not display processing information-v displays verbose processing information-c< number > bytes displayed-n< number of rows > Display lines--pid=pid is combined with-F to end after the process id,pid dead. -Q,--quiet,--silent never outputs the header-S of the file name,--sleep-interval=s with-F, which represents the sleep s seconds at each repetition interval
Second, the Linux tail command use example

1) View the last few lines of the file

 $tail-5 linuxdaxue.com-access_log180.175.51.163--[14/jun/2016:11:45:09 +0800] "GET http://www.linuxdaxue.com/ Wp-content/uploads/2016/05/shell-printf_thumb.jpg&h=64&w=100&q=90&zc=0&ct=1 HTTP/1.1 "200 2611180.175.51.163--[14/jun/2016:11:45:09 +0800] "GET Http://www.linuxdaxue.com/wp-content/uploads/2016/05/Shell_ Thumb-2.jpg&h=64&w=100&q=90&zc=0&ct=1 http/1.1 "2572180.175.51.163--[14/Jun/2016:11:45:09 +0800] "GET http://www.linuxdaxue.com/wp-content/uploads/2016/05/Shell_thumb-3.jpg&h=64&w=100&q=90 &zc=0&ct=1 http/1.1 "2580180.175.51.163--[14/jun/2016:11:45:09 +0800]" GET http://www.linuxdaxue.com/ Wp-content/uploads/2016/05/shell_thumb-1.jpg&h=64&w=100&q=90&zc=0&ct=1 HTTP/1.1 "200 2646180.175.51.163--[14/jun/2016:11:45:09 +0800] "GET Http://www.linuxdaxue.com/wp-content/uploads/2016/06/Shell_ Thumb-1.jpg&h=64&w=100&q=90&zc=0&ct=1 http/1.1 "2850$ 

2) show file starting from line 10th

Tail-n +10 Linuxdaxue.com-access_log

3) Cyclic monitoring log file

$tail-F linuxdaxue.com-access_log180.175.51.163--[14/jun/2016:11:45:09 +0800] "GET http://www.linuxdaxue.com/ Wp-content/uploads/2016/05/shell_thumb-1.jpg&h=64&w=100&q=90&zc=0&ct=1 HTTP/1.1 "200 2646180.175.51.163--[14/jun/2016:11:45:09 +0800] "GET Http://www.linuxdaxue.com/wp-content/uploads/2016/06/Shell_ Thumb-1.jpg&h=64&w=100&q=90&zc=0&ct=1 http/1.1 "200 2850

In actual use, our more common function is to use it to monitor log files, which is a very useful feature.

For more information on Linux commands, see: Linux Command Quick check manual

    • Copyright Notice: original article, 4 months ago, published by the University of Linux (linuxdaxue.com), a total of 1686 words.
    • reprint Please specify: Linux Command-tail Command | Linux University

Linux Command-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.