New learned a less command. Take a look at some tutorials, give you options and explanations directly, and read too hard to remember them well. I'll just talk about using it.
First, there are times when you want to query a log at a point in time, or see an exception for an operation. At this point, you need to search the full log. Introduce the simple usage of less.
First step, less view file
Less Log file name
1, this time, use the key combination
Shift + G
You can navigate to the end of the file.
At the end of the file, use the key combination (starting at the end to retrieve the string that you entered later)
shift +?
Then enter the query criteria, either a time string or a keyword, such as the log has a print userid, then enter the problematic UserID, detect all the logs that have the UserID appear.
Using the Y key, you can navigate up to
2, if not positioned to the end, use the combination key (retrieved from the beginning of the file)
shift +/
Then, enter the string you want to query.
Using key combinations
Shift + N
Look down to the next keyword.
Of course, direct enter is also possible.
This makes it easy to locate the log based on the point in time. Or find out if something went wrong, depending on the query you want.
Another grep command, simply put,
View the log (see where a string appears):
grep -i ' search content ' log file name '
Interview also encountered, asked to query the number of occurrences of a file string, the command is as follows, with the-C option:
Grep-c ' Search content ' log file name '
Linux Find command grep and less