LINUX Filter Log by Keyword

Friday, December 8th, 2023 | System
Last Modified: 2024-04-27



To modify the command tail -F -n 100 access.log to filter based on a keyword, you can use a pipe (|) to pass the output of tail to grep, which is a command-line utility for searching plain-text data for lines that match a regular expression. Here's how you do it:

tail -F -n 100 access.log | grep "your_keyword"

Replace "your_keyword" with the specific word or pattern you're looking for. This command will continuously follow the access.log file (due to -F) and display the last 100 lines (due to -n 100), but only those lines that contain your specified keyword will be shown.




Input Action Output
A collection of snippets and links that have proven useful for development, programming, ColdFusion, Javascript, jQuery, PHP, Python, Dell, Minecraft, Apple, Mac, Windows, LINUX, Raspberry Pi, Adobe, CSS, and HTML.

©2024 Input Action Output