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.