The "grep" command is commonly used in Linux to search for a specific string in a file.
Here's an example:
grep "search_string" file_name.txt
In this example, search_string is the string you're searching for, and file_name.txt is the name of the file you want to search in.
If you want to search for a string in all files in the current directory, you can use the following command:
grep -r "search_string" .
The -r option is used to search recursively in all subdirectories. The . at the end specifies the current directory.
Note that grep is case-sensitive by default, but you can make it case-insensitive using the -i option:
grep -i "search_string" file_name.txt
Top comments (0)