
Find all files containing a specific text (string) on Linux?
Jun 6, 2013 · find /path -type f -exec grep -l "string" {} \; Explanation from comments. find is a command that lets you find files and other objects like directories and links in subdirectories of a given path. If you don't specify a mask that filesnames should meet, it …
How to use grep to search for strings in files on the Linux shell
Jan 16, 2025 · The grep command in Linux is a powerful text-search utility that allows users to search through files or streams of text for specific patterns.
How to use "grep" command to find text including subdirectories
Aug 1, 2011 · To search for the string and output just that line with the search string: $ for i in $(find /path/of/target/directory -type f); do \ grep -i "the string to look for" "$i"; done e.g.: $ for i in $(find /usr/share/applications -type f); \ do grep -i "web browser" "$i"; done To display filename containing the search string:
grep command in Unix/Linux - GeeksforGeeks
Apr 11, 2025 · The grep command in Unix/Linux is a powerful tool used for searching and manipulating text patterns within files. Its name is derived from the ed (editor) command g/re/p (globally search for a regular expression and print matching lines), …
How to find a string or text in a file on Linux - LinuxConfig
Jan 21, 2023 · To search a file for a text string, use the following command syntax: For example, let’s search our document.txt text document for the string “example.” As you can see from the screenshot, grep returns the entire line that contains the word “example.” If the string occurs on multiple lines, then all of those lines will be returned as well.
Grep Command in Linux | Linuxize
Jan 23, 2024 · grep is a command-line utility that searches for a specific text string in one or more files. It looks for the pattern in each line of the file and prints out the lines that match it. It is a powerful tool for searching and analyzing large amounts of text data quickly and efficiently.
20 grep command examples in Linux [Cheat Sheet]
Jan 1, 2024 · grep is a command-line tool in Linux used for searching a pattern of characters in a specific file. That pattern is called the regular expression . grep stands for Global Regular Expression Print . It prints all lines containing the pattern in a file.
How to Use the grep Command on Linux - How-To Geek
To search for a string within a file, pass the search term and the file name on the command line: Matching lines are displayed. In this case, it is a single line. The matching text is highlighted. …
How to Use Grep Command in Linux with Practical Examples
Mar 5, 2025 · Grep stands for "Global Regular Expression Print." It's a command-line utility that searches text files for lines matching a specified pattern and prints those lines to standard output. The name comes from the ed command g/re/p, which does a similar function in the ed text editor.
Bash grep Command - Search Text Using Patterns - W3Schools
The grep command has options to change how it works:-i - Search ignoring case differences (uppercase or lowercase)-r - Search through all files in a directory and its subdirectories-v - Find lines that do not match the pattern
- Some results have been removed