In daily work, we often need to view logs. For example, we can view logs in real time through the tail command, or we can view log information through commands such as cat . But now we are going to discuss how to filter out the content we want from the log by keywords. There are many ways to do this. Today we will mainly learn about the cat command. Assume that there is a log file hrun.log , and the query keyword is "new user": View logs by keyword View the last 10 lines of logs according to keywords View the first 10 log lines by keyword View the 10 lines of logs before and after the keyword and display the line numbers View the first 50 lines of the log View the last 50 lines of the log and display the line number illustrate:
The above is all the knowledge points about finding keywords in Linux logs introduced this time. Thank you for your learning and support for 123WORDPRESS.COM. |
<<: Elegant practical record of introducing iconfont icon library into vue
>>: Examples of optimistic locking and pessimistic locking in MySQL
Get a deep understanding of how the Linux configu...
After getting used to VM, switching to BOX is a l...
Table of contents 1. Problem scenario 2. Cause An...
1. Download the alpine image [root@docker43 ~]# d...
Kernel: [root@opop ~]# cat /etc/centos-release Ce...
Table of contents Preface Case: Imitation of JD.c...
I've been learning Kafka recently. When I was...
Download the image (optional step, if omitted, it...
Overview In zabbix version 5.0 and above, a new f...
MySQL replace and replace into are both frequentl...
Basic syntax: <input type="hidden" na...
Table of contents Overview 1. Simple Example 1. U...
function 0. Display current time Command: select ...
Table of contents Preface Related Materials Vue p...
This article shares the implementation code of jQ...