Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the tail command of linux to view the tail of the file

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

What the editor shares with you today is to use the tail command of linux to view the tail of the file. I believe many people don't know much about it. In order to make you understand better, I summarized the following contents for you. Let's look down together. I'm sure you'll get something.

Tail is used to display the contents of the end of the file, and the last 10 lines of the specified file are displayed on the screen by default. If more than one file is given, each file displayed is preceded by a file name title. If no file is specified or the file name is "-", standard input is read.

Syntax format: tail [parameters]

Common parameters:

-- retry means that when the tail command starts, the file is inaccessible or later becomes inaccessible, always trying to open the file. This option needs to be used with the option "--follow=name"

-c or-- N (N is integer) byte content at the end of the bytes= output file

-f--follow: displays the latest appended contents of the file

-F has the same function when used with options "- follow=name" and "--retry"

-n or-- N (N digit) lines at the end of the line= output file

-- pid= is used with the "- f" option to automatically exit the tail command when the process of the specified process number terminates

-- help displays help information for instructions

-- version displays the version information of the instruction

Reference example

Display the last 10 lines of the file file:

[root@linuxcool ~] tail file

Displays the contents of the file file, from line 20 to the end of the file:

[root@linuxcool ~] tail + 20 file

Displays the last 10 characters of the file file:

[root@linuxcool] tail-c 10 file

Files that are constantly changing always show the last 10 lines:

[root@linuxcool] tail-f 10 file

Display help information:

[root@linuxcool ~] tail-- help on using the tail command of linux to view the tail of the file is shared here. I hope the above content can be used as a reference for everyone. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report