In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the tail command, with certain reference value, interested friends can refer to, I hope you have a lot of gains after reading this article, let Xiaobian take you to understand.
tail command syntax
1. tail command syntax
tail [ -f ] [ -c Number | -n Number | -m Number | -b Number | -k Number ] [ File ]
Parameter explanation:
-f This parameter is used to monitor file growth.
-c Number reads the specified file from the Number byte position
-n Number Reads the specified file from the Number row position.
-m Number Reads the specified file from the position of the Number multibyte character, e.g. your file is assumed to include Chinese characters, assuming that specifying the-c parameter may cause truncation, but using-m avoids this problem.
-b Number Reads the specified file from the 512-byte block position represented by Number.
-k Number Reads the specified file from the 1KB block location represented by Number.
File Specifies the name of the target file for the operation
In the above commands, all involve number, assuming that it is not specified, the default display is 10 lines. Number can be preceded by a sign to indicate whether the offset is calculated from the top or the bottom.
tail Runnable files are generally located below/usr/bin/.
II. Demonstration example of tail command using method
1、tail -f filename
Note: Monitor the end of filename file (default 10 lines, equivalent to adding parameter-n 10), refresh display on screen. To exit, press CTRL+C.
2、tail -n 20 filename
Description: Displays the last 20 lines of filename.
3、tail -r -n 10 filename
Note: Display the last 10 lines of filename in reverse order.
Additional:
Similar commands to tail include:
cat Displays the file contents starting with the first line.
tac displays the file contents starting with the last line.
More Pages show file content.
Less is similar to more, but supports page forward.
head shows only the first few lines
tail shows only the next few lines
n with line number shows file content
od displays file contents in binary format
View tomcat logs
tail -f catalina.out
You can view the output log hidden when starting tomcat under Linux, but you can only view the last 10 lines, ctrl+c can exit
To view the startup log of a specific day, you can use sh startup.sh && tail -f ../ logs/catalina.2018-08-29.log
First install telnet client on window yes, and then use telnet 192.168.7.68 8081 in cmd to communicate.
Thank you for reading this article carefully. I hope that the article "how to use tail command" shared by Xiaobian will help everyone. At the same time, I hope everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!
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: 248
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.