redhat 7.6 find command

1. Find by Name

find ./ -name filename // pinpoint. / -name inquiry on behalf of the current directory name filename specific file name   

find ./ -name "* file *" // fuzzy search

 

2. Find a time

find ./ -mtime -2 // figures in the number of days, within 2 days. All content 2 + 2 days

Representative find ./ -mmin -5 // 5 minutes + 55 minutes after all the contents of the

 

3. Find the file size

find ./ -size + 10M // Find the files larger than 10M

find ./ -size -10M // find files of less than 10M

 

4. Find by object type

find ./ -type f // Find by ordinary file

find ./ -type l // Find by link files

find ./ -type d // Find out by file

find ./ -type f -or -type d // find common files and directories are displayed together  

find ./ -maxdepth 1 -type f -or -type d // - maxdepth set up to find the directory level

find ./ -maxdepth 1 -type f -or -type d -exec ls -lh {} \; // Find out using the exec content execution of a command ls -lh, {} representative of the searched content, \ End

find ./ -perm / 4000 -exec cp -rvf {} / tmp / test / \; // to find contents cp under / tmp / test / directory

find ./ -name "* .log" -a -mmin -30 -a size + 100M -exec ls -lh {} \; // Find suffix log, over 30 minutes, greater than 100M file, and finally displayed

 

5. Find by user

find ./ -user usertest // Find what users belong to usertest

find ./ -uid 1001 // Find what belongs to the 1001uid

Find a group of the same gid, group

 

6. Find by permission

find ./ -perm 600 // 600 permissions to find all files

find ./ -perm -600 // Find all rights to all files that contain 600

find -perm +600 // find matching rights ./ similar effect without the + sign

find ./ -perm / 600 // matches any of these will be a privilege to find out

find ./ -perm -4000 // Find special permission bits - and / can

find ./ -perm -2000 // Find special permission bits - and / can

find ./ -perm -1000 // Find special permission bits - and / can

 

Guess you like

Origin www.cnblogs.com/MOMING95/p/11754567.html