File search command for linux study notes

1. find [search in] [filename]

  Example:

  find /etc -name init Find the file init in etc (another: iname is not case sensitive)

 

  find /etc -size +204800 Find files larger than 100M in etc 

                          -204800 Less than 100M files

                          Data block 1=512 bytes=0.5K

 

   -user zhangsan file owner

 

 

   -group root file belongs to group

 

   -amin Access time +5 Modified over 5 minutes -5 Modified within 5 minutes

   -cmin change file attributes +5    

   -mmin change file content -5 change file content within 5 minutes

 

 

   -a and Multiple conditional logical AND

        find /etc -size +204800 -a size -102400 Find files larger than 50M and smaller than 100M 

   -o or Multiple conditional logical or

 

   -type Find f (file) d (folder) l (soft link) by file type

 

   -exec {} \; execute command on search results

    {}: Represents the found file \; Escape; end

 

2.locate

 

Similar to everything in Windows 

locate aaa finds files with aaa in the file name -i is not case sensitive

Principle: Find files in the data index library  

           updatedb manually update the new command library

           There is no index in the /tmp temp folder 

 

3.which

whereis command lists paths to help documentation

 

4.grep search based on file content

grep -i keyword filename

         -v exclude the specified string

 

   

    

 

    

       

      

 

  

                   

     

  

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327039475&siteId=291194637