Blogs

Fix Kali Linux Black Screen after boot? 8 Proven Fixes
June 6, 2025
Qualcomm to Buy Alphawave for $2.4 Billion in Bid to Strengthen Data Center Position
June 10, 2025Prep Command in Linux: All You Need To Know
Prep Command in Linux
Basic Syntax
The general syntax for grep is:
grep [OPTIONS] PATTERN [FILE…]
This command searches for the specified PATTERN in the given FILE or from standard input.
Commonly Used Options
- -i: Performs a case-insensitive search.
- -v: Inverts the match to select non-matching lines.
- -n: Displays line numbers along with matching lines.
- -r or -R: Recursively searches directories.
- -c: Counts the number of matching lines.
- -l: Lists filenames containing the match.
- -w: Matches whole words only.
- -x: Matches whole lines only.
- -E: Uses extended regular expressions.
- -F: Interprets the pattern as a list of fixed strings.
- -q: Suppresses output; useful for scripting.
Read more: Windows Dedicated Server Vs Linux Dedicated Server
Practical Examples
Basic Search: Find lines containing “error” in app.log:
grep “error” app.log
Case-Insensitive Search: Find lines containing “Warning” regardless of case:
grep -i “warning” app.log
Line Numbers: Display line numbers where “critical” appears:
grep -n “critical” app.log
Recursive Search: Search for “timeout” in all .log files within a directory:
grep -r “timeout” *.log
Count Matches: Count occurrences of “failed” in auth.log:
grep -c “failed” auth.log
Exclude Matches: Show lines that do not contain “debug“:
grep -v “debug” app.log
Contextual Lines: Display 2 lines before and after each match for “error“:
grep -B 2 -A 2 “error” app.log
Using Regular Expressions: Match lines starting with “start” or ending with “end”:
grep -E “^start|end$” file.txt
Search Compressed Files: Search within a gzipped file:
zgrep “pattern” file.txt.gz
Combining with Other Commands
grep can be combined with other commands using pipes to filter their output:
- List all processes and filter for “nginx“:
ps aux | grep “nginx“
:contentReference[oaicite:105]{index=105}
– :contentReference[oaicite:107]{index=107}:contentReference[oaicite:109]{index=109}
find . -name “*.mp3” | grep -i “JayZ” | grep -vi “remix“
:contentReference[oaicite:112]{index=112}
:contentReference[oaicite:114]{index=114}:contentReference[oaicite:116]{index=116}
If you have specific scenarios or need further assistance with `grep`, feel free to ask!
::contentReference[oaicite:117]{index=117}
One server. One user. One unstoppable experience. That’s real dedication.
Cores
RAM
Storage
Location
Monthly Price
Link
Intel Xeon E3-1240 v6 3.7GHz 4c/8t
64 GB DDR4
2 x 500 GB (SSD SATA)
Amsterdam
$79.95 /month
Buy Now
Dual Intel Xeon E5-2670 2.60 GHZ Octa Core (16 cores)
256 GB DDR 3
Storage: 2 x 480 GB SSD
Florida
$259.95 /month
Buy Now
Dual Intel Xeon E5-2697 2.70 GHZ v2 (24 Cores / 48 Threads)
512 GB DDR 3
Storage: 2 x 480 GB SSD
Florida
$359.95 /month
Buy Now
Muhammad Osama
Featured Post
Linux Mint vs Ubuntu: 10 Ultimate Comparison Points
Table of Contents Key Takeaways: Understanding Ubuntu Linux and Mint Linux Linux Mint vs Ubuntu: Are Linux and Ubuntu the Same? Linux Mint vs Ubuntu: Core […]
Best GPU for Gaming: 13 Killer Performance Picks
Table of Contents What Is the Best GPU for Gaming in 2026? Key Takeaways: Why Does the GPU Matter More Than Ever? How to Choose the […]
What Is a Proxy Server? The Smart Way to Browse in 2026
Table of Contents 5 Key Takeaways: What Is a Proxy Server? How Does a Proxy Server Work? What Does a Proxy Server Do? Proxy Server vs […]



