?>

Linux file search. Search for text in files

Perhaps you know such a problem as: You can not find the file, but it is somewhere in the computer. Then find command is convenient.

You ask: How to use it? This program is given a huge man page, we will look at some common cases.

You can start with the simplest: If you know the name of the file, then you can easily find it! You just need to type the find command and specify a specific file name!

Linux file search by name

find -name love 

For example, we will search for all files in mp3 format and make a complete list in the file:

file /home/artix -iname ".mp3" > ./list.txt 

Search for specific files with specific content

find private/ -iname '*.js' -exec grep -H 'eval(' '{}' ';' > /tmp/list-all.txt 
find private/ -iname '*.js' -exec grep -H 'eval(function(p,a,c,k,e,d)' '{}' ';' > /tmp/list-final.txt 

All Comments (0)
No Comments