Linux Command -- tail, linux -- tail

Source: Internet
Author: User

Linux Command -- tail, linux -- tail

Linux tail command to display the content at the end of the file

Syntax: tail [parameter] [parameter value] [file name]

Parameter description:

-N: displays the specified number of rows forward from the end of the file.

-F: the specified number of lines are displayed from the end of the file. When new content is written to the file, the new content is dynamically displayed on the screen.

Example:

Bytes ------------------------------------------------------------------------------------------------------------------------

Upload 1.txt content

[Root @ test tools] # cat 1.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

Bytes --------------------------------------------------------------------------------------------------------------------

Rows 5 at the end of 1.txt

[Root @ test tools] # tail-n 5 1.txt
19
20
21
22
23

Bytes --------------------------------------------------------------------------------------------------------------------

The tail command displays 10 lines of content at the end of the file by default.

[Root @ test tools] # tail 1.txt
14
15
16
17
18
19
20
21
22
23

Bytes --------------------------------------------------------------------------------------------------------------------

Dynamic Display content at the end of 1.txt

[Root @ test tools] # tail-f 1.txt
18
19
20
21
22
23
24
25
26
27

 

After the written content is displayed:

[Root @ test tools] # tail-f 1.txt
18
19
20
21
22
23
24
25
26
27
New1
New2
New3
New4
New5

Bytes -----------------------------------------------------------------------------------------------------------------

Run Ctrl + c to end the running program and run the tail-f command. You can run Ctrl + c.

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.