https://github.com/hassanamohamed/linux-tools-and-troubleshooting
mygrep.sh - Lightweight grep alternative featuring line numbers (-n), inverted matches (-v), and case-insensitive search DNS Troubleshooting - Systematic approach to diagnose web service issues through DNS verification and connectivity testing
https://github.com/hassanamohamed/linux-tools-and-troubleshooting
devops-tools dns-server git github linux networking scripting troubleshooting
Last synced: 3 months ago
JSON representation
mygrep.sh - Lightweight grep alternative featuring line numbers (-n), inverted matches (-v), and case-insensitive search DNS Troubleshooting - Systematic approach to diagnose web service issues through DNS verification and connectivity testing
- Host: GitHub
- URL: https://github.com/hassanamohamed/linux-tools-and-troubleshooting
- Owner: HassanAmohamed
- Created: 2025-04-28T09:23:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-28T12:58:09.000Z (about 1 year ago)
- Last Synced: 2025-04-28T13:56:07.550Z (about 1 year ago)
- Topics: devops-tools, dns-server, git, github, linux, networking, scripting, troubleshooting
- Language: Shell
- Homepage:
- Size: 250 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Linux Command Line Utilities
## 1. mygrep.sh - Custom grep Implementation
A minimal grep clone with basic pattern matching functionality.
### Features
- Case-insensitive string search
- Line number display (`-n`)
- Inverted matching (`-v`)
- Combined flags support (`-nv`, `-vn`)
- Input validation
### Usage
```bash
./mygrep.sh [OPTIONS] PATTERN FILENAME
Examples
bash
./mygrep.sh hello file.txt # Basic search
./mygrep.sh -n hello file.txt # With line numbers
./mygrep.sh -vn hello file.txt # Inverted match
Testing
Test file included with sample content:
Hello world
Test line
Another hello
No match here
2. DNS Troubleshooting Guide
Comprehensive steps to diagnose and resolve internal.example.com connectivity issues.
Troubleshooting Steps
DNS Verification
bash
dig internal.example.com
dig @8.8.8.8 internal.example.com
Service Reachability
bash
curl -Iv http://$(dig +short internal.example.com)
ss -tulnp | grep ':80\|:443'
Common Fixes
Issue Verification Solution
Wrong DNS cat /etc/resolv.conf nmcli con mod eth0 ipv4.dns "192.168.1.1"
Firewall ufw status ufw allow out 53/tcp
Bonus
bash
# Hosts file bypass
$ echo "192.168.1.100 internal.example.com" | sudo tee -a /etc/hosts
# Persistent DNS
$ sudo resolvectl dns eth0 192.168.1.1
Implementation Notes
mygrep.sh
Uses getopts for argument parsing
Handles combined flags intelligently
Validates input before processing
DNS Troubleshooting
Checks both DNS and service layers
Provides temporary and permanent solutions
Includes network diagnostics
Requirements
Bash shell (for mygrep.sh)
dig, curl, ss utilities (for DNS troubleshooting)
$ sudo privileges for system changes