Find the file name in the current directoryrumenz.txt

> find rumenz.txt
rumenz.txt
Copy the code

To find the/homeFile nameruemnz.txtFile, ignore case

> find /home -iname rumenz.txt
Copy the code

Find directories by name

> find / -type d -name rumenz
Copy the code

Find all in the current directoryphpThe file

> find -type f -name "*.php"
Copy the code

To find the777A file with two permissions

> find / -type f -perm 777
Copy the code

Find SGID files with 644 permissions

> find / -perm 2644
Copy the code

Find the sticky bit file with 551 permission

Find all Sticky Bit setting files with permission 551.

> find / -perm 1551
Copy the code

Find the SUID file

> find / -perm /u=s
Copy the code

Finding a read-only file

> find / -perm /u=r
Copy the code

Find executable files

> find / -perm /a=x
Copy the code

Find the777Permission file and change the permission to755

> find / -type d -perm 777 -print -exec chmod 755 {} \;
Copy the code

Find and delete files

> find / -type f -name "*.log" -exec rm -f {} \;
Copy the code

Find all empty files

> find / -type f -empty 
Copy the code

Find all empty directories

> find / -type d -empty
Copy the code

Find all hidden files

> find / -type f -name ".*"
Copy the code

The search group isrootAll files of

> find / -user root -name "*.sh"
Copy the code

The search group isdevAll files of

> find / -group dev
Copy the code

Search for files whose content has been modified in the last 30 days

> find / -mtime -50 -type f
Copy the code

Find files with changes made in the last 30-100 days

> find / -mtime +30 -mtime -100
Copy the code

Find files that have been modified in the last 60 minutes

> find / -mmin -60 -type f
Copy the code

Search for files accessed in the last 60 minutes

> find / -amin -60 -type f
Copy the code

Find the 50M file

> find / -size 50M -type f
Copy the code

Find files between 30M and 100M

> find / -size +30M -size -100M -type f
Copy the code

Find files larger than 500M to delete

> find / -size +500M -exec rm -rf {} \;
Copy the code

Find all files larger than 500M.logEnd the file and delete it

> find / -size +500M -type f -exec rm -rf {} \;
Copy the code

Original link :rumenz.com/rumenbiji/l… Wechat official account: entry station