The command-line tool to search for specific words is typically grep
. Here’s how you can use it:
Basic Syntax
grep "search_term" file_name
Examples
Search for a specific word in a file:
grep "proxy" /etc/nginx/nginx.conf
Search recursively in a directory:
grep -r "proxy" /path/to/directory
Search with line numbers:
grep -n "proxy" file_name
Ignore case sensitivity:
grep -i "proxy" file_name
Show only matching filenames:
grep -l "proxy" /path/to/directory/*
For Large Outputs: Combine with less
or more
To make results easier to read:
grep "proxy" file_name | less