The GREP Command – Complete Guide
USA
Brooks Computing Systems - Jacksonville
Visit Brooks Computing Systems
Mainframes, Desktops & Web Sites
Brooks Computing Systems

GREP is a Unix/Linux command used to search text for patterns using regular expressions. It prints only the lines that match.

grep "pattern" file
Examples:
grep "error" log.txt
grep -i "error" log.txt
grep -n "main" source.c

  • -i → ignore case
  • -r → recursive
  • -n → line numbers
  • -c → count
  • -v → invert match
  • -w → whole word

grep "^root" /etc/passwd
grep "[0-9]\{3\}" file
grep -E "error|fail|panic" log.txt

Find failed SSH logins:
grep "Failed password" /var/log/auth.log
Find function references:
grep -r "initDatabase" src/

• Insanely fast (written in C)
• Handles massive files
• Full regex engine
• Always installed
• Foundation of shell pipelines

grep is the backbone of Unix search.
Quality, Reliability & Service        Consultancy for Mainframes, Desktops & Web Sites
Visit https://bcs.archman.us Contact Us https://bcs.archman.us/contact Languages
Thank You For Visiting
Brooks Computing Systems
USA
Brooks Computing Systems - Jacksonville
Visit Brooks Computing Systems
Mainframes, Desktops & Web Sites
Quality, Reliability & Service
Visit Visit Our Site