highlight is a script to detect and highlight patterns such as URLs, domains, IPv4 addresses, IPv6 addresses, subnets, ports, categories, HTML tags, and more.
Introduction
In the world of system administration, network management, and development, analyzing log files and text streams is a daily routine. Manually sifting through plain text can be tedious and error-prone. What if you could make important information pop out with color? Enter highlight—a powerful, customizable script that uses awk to highlight specific patterns in your text files.
In this guide, we’ll explore practical use cases of the highlight command to supercharge your terminal experience.
Why Use highlight?
highlight
can highlight:
- IPv4 and IPv6 addresses
- Subnet masks
- URLs
- Domains with ports
- Common network ports (e.g., 80/tcp)
- Important script details
- Text inside parentheses
- HTML tags and attributes
- With these capabilities, highlight makes it easier to identify and analyze crucial information in logs and other text streams.
Usage Examples
Here are some practical use cases to demonstrate how highlight can be used with common tools.
1.Highlighting Patterns in Log Files
Logs are essential for troubleshooting and monitoring systems. highlight can make critical information in logs stand out.
highlight < /var/log/apt/history.log
Example:
In this example, it highlight keys, and other important patterns will be highlighted, making it easier to spot issues or important events in your system logs.
2.Highlighting Output from nmap
nmap is a powerful network scanning tool. Highlighting its output can help quickly identify open ports, IP addresses, and more.
sudo nmap -sV -sC -Pn hackerone.com | highlight
Example:
With highlight, the output from nmap scans will be more readable, allowing you to easily see open ports, service details, and potential vulnerabilities.
3.Highlighting Output from ifconfig
The ifconfig command displays network interface configuration. Highlighting IP addresses and netmasks can make the output more readable.
ifconfig | highlight
4.Highlighting Output from curl
curl is used for transferring data with URLs. Highlighting URLs and other critical parts of the output can be very helpful.
curl -i -s https://www.hackerone.com | highlight
Example:
This example makes HTTP headers, HTML tags and other important parts of the curl output stand out, which is useful for debugging web requests or inspecting server responses.
Conclusion
highlight is a versatile tool that can greatly improve the readability of your terminal output by highlighting important patterns. Whether you are analyzing logs, network configurations, or HTTP responses, highlight can help you quickly spot the information you need.
Give it a try and transform the way you interact with text in your terminal!
Checkout here: Github
Your’re Welcome!
Top comments (0)