find command Detailed

First, the main content

======================================

1. Find the file with the file name

2. Find the file with a file name, ignoring case

3. mindepth depth and defining the specified directory search maxdepth

4. Run on the find command to find files

5. inversely match

6. Use the inode number lookup file

7. Look for files based on file permissions

8. find all the empty files (0 byte file) home directory and subdirectories

9. Find five largest files

10. Find five smallest file

11. Use the -type find the specified file type

12. Compare to find files by modification time, and other files

13. Find files by file size

14. Common to find operations aliased

15. Delete the large file packaged with the find command

16. Locate the file to be changed within one hour

17. Locate the file is accessed within one hour

18. Find a file within an hour status changed

19. Search only limited to files that do not display the folder

20. Find only non-hidden files (not show hidden files)

21. Find files modified files modified after a certain file

22. Find the file access time of the file after the modification time of a file

23. Find time to change the status of a file after file modification time:

24. For more information on using the find command ls -l output, include the edited file in 1 hour

25. The search only in the current file system

26. The use of a plurality of the same command} {

27. The use of a plurality of instances {}

28. The error is redirected to / dev / nul

29. The file name space into an underscore

30. The two simultaneously executed the find command results

31, common commands

======================================

 

Two, find practical examples of command summary

======================================

First, based on the query file name

# find . -name tecmint.txt

# find /home -name tecmint.txt

# find /home -iname tecmint.txt

# find / -type d -name Tecmint

# find . -type f -name tecmint.php

# find . -type f -name "*.php"

 

 

Second, based on the query file permissions

# find . -type f -perm 0777 -print

# find / -type f ! -perm 777

# find / -perm 2644

# find / -perm 1551

# find / -perm /u=s

# find / -perm /g+s

# find / -perm /u=r

# find / -perm /a=x

# find / -type f -perm 0777 -print -exec chmod 644 {};

# find / -type d -perm 777 -print -exec chmod 755 {};

# find . -type f -name "tecmint.txt" -execrm -f {} ;

# find . -type f -name "*.txt" -exec rm -f{} ;

# find . -type f -name "*.mp3" -exec rm -f{} ;

# find /tmp -type f -empty

# find /tmp -type d -empty

# find /tmp -type f -name ".*"

 

 

Third, based on user and group query file

# find / -user root -name tecmint.txt

# find /home -user tecmint

# find /home -group developer

# find /home -user tecmint -iname "*.txt"

 

Fourth, time-based query file or directory

# find / -mtime 50

# find / -atime 50

# find / -mtime +50 –mtime -100

# find / -cmin -60

# find / -mmin -60

# find / -amin -60

 

Fifth, based on the size of the file or directory inquiries

# find / -size 50M

# find / -size +50M -size -100M

# find / -size +100M -exec rm -rf {} ;

# find / -type f -name *.mp3 -size +10M -exec rm {} ;

========================================

Guess you like

Origin www.cnblogs.com/zhou2019/p/11080973.html