Mostrando entradas con la etiqueta grep. Mostrar todas las entradas
Mostrando entradas con la etiqueta grep. Mostrar todas las entradas

martes, 11 de enero de 2011

How to find Strings in linux directory

To find some string in a directory you can find a String in this way:

ps aux | grep stringToFind

Example, you have a directory called Fruit, which contains all kind of files with fruits. You need to search the file/s containing the word "Apple"

you go to Fruit directory:
cd /home/username/Fruit

then you search for the word Apple in all subdirectory:
ps aux | grep Apple *
ps aux | grep Apple */*
ps aux | grep Apple */*/*
 
... and so on till you have this indication:

grep: No match.

This means that you don't have any more subdirectories to explore

Up to know I use this command because is the simplest one.