Tail command

Tail command usage diagram:Common command examples are as follows: 1 Dynamically view the latest write logs

tail -f   filename.log   # loop read latest write log CTRL + C interrupt log display
Copy the code

② Dynamically view the latest logs and filter the logs by keyword

tail -f   filename.log |  grep 'Keyword'   # command via the pipe "|" combined cycle to read the latest log log shows CTRL + c interrupt
Copy the code

More orders

More command usage diagram:Common command examples are as follows: ① Press the space bar to dynamically view file contents

more filename.log
Copy the code

Press space to display the next screen of text; Press Enter to display only the next line of text. Press H to display the help screen with related help information. Press B to display the contents of the previous screen; Press Q to exit the more command. (2) combining with the pipe “|” multiple commands used in combination

more  filename.log | grep 'Keyword'
Copy the code

③ Find the content before and after the keyword

more filename.log | grep 'Keyword' -B 10   # 10 lines before
more filename.log | grep 'Keyword' -C 10   # 10 lines
Copy the code

More good articles please pay attention to the public number: main method