HOME > Linux > Linux Find Text In Files - With These Commands It Works

Linux find text in files - with these commands it works

Linux is a free, UNIX-like operating system. Depending on the derivative, you have more or less of a user interface at your disposal. Regardless, you can perform various functions via the console. This includes, for example, finding files that contain a certain text.

How to find a text in files on your Linux system

Once you have installed Linux on your PC, navigation and operation is mostly done via the console. For this, you have numerous commands at your disposal, which you can use to perform any task with ease. For example, if you are looking for documents that contain a specific text, then this operation is also possible with a suitable command.
  1. With the command "grep" you can search for a specific text within all files and output the file path.
  2. An example for this command is "grep -rnwi '/path/to/folder/' -e 'text'" without quotes at the beginning and end.
  3. The letters after "grep" specify how the search should be done. In this case, recursively (-r), the text must match completely (-w) and it should not be case sensitive (-i).
  4. Möchten Sie Beispielsweise im Ordner „Computer“ nach dem Text „Bild“ suchen, dann geben Sie als Befehl „grep -rwi '/home/Computer/' -e 'Bild'“ ohne Anführungszeichen an.
  5. Den Befehl können Sie durch verschiedene Zusätze Ihren gewünschten Suchanfragen anpassen.

By Portwin Troyani

Create GIF images online - it's possible here for free :: Set up AirPods - configure your headphones
USEFUL LINKS