In the current directory, find all files named linuxprobe.txt
# find . -name linuxprobe.txt ./linuxprobe.txt
Find all files named linuxprobe.txt in the home directory
# find /home -name linuxprobe.txt /home/linuxprobe.txt
Search for a file named linuxprobe.txt in a specific directory, ignoring the case of the file name
# find /home -iname linuxprobe.txt ./linuxprobe.txt ./Linuxprobe.txt
Look for a directory named linuxprobe in the root directory
# find / -type d -name linuxprobe /linuxprobe
Find the file named linuxprobe.php in the current directory
# find . -type f -name linuxprobe.php ./linuxprobe.php
# find . -type f -name "*.php" ./linuxprobe.php ./login.php ./index.php
Find all files with permission 777 in the current directory
# find . -type f -perm 0777 -print
Find all files in the root directory with permissions other than 777
# find / -type f ! -perm 777
# find / -perm 2644
# find / -size +100M -exec rm -rf {} \;
# find / -perm /u=s # find / -perm /g=s
# find / -type f -name *.mp3 -size +10M -exec rm {} \; #常用find操作,通过find出指定目录下的特定类型特定名称的文件,然后进行修改,移动,删除等操作。
# 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 "linuxprobe.txt" -exec rm -f {} \;
# find . -type f -name "*.txt" -exec rm -f {} \; OR # find . -type f -name "*.mp3" -exec rm -f {} \;
# find /tmp -type f -empty
# find /tmp -type d -empty
# find /tmp -type f -name ".*"
# find / -user root -name linuxprobe.txt
# find /home -user linuxprobe
# find /home -group developer
# find /home -user linuxprobe -iname "*.txt"
# find / -mtime 50
# find / -atime 50
# find / -mtime +50 –mtime -100
# find / -cmin -60
# find / -mmin -60
# find / -amin -60
# find / -size 50M
# find / -size +50M -size -100M
本文原创地址:https://www.linuxprobe.com/linux-33-find.html作者:王毅,审核员:逄增宝
本文原创地址:https://www.linuxprobe.com/linux-33-find.html编辑:王毅,审核员:暂无
The above is the detailed content of Commonly used Find command examples under Linux: 33 cases. For more information, please follow other related articles on the PHP Chinese website!