Home > Article > System Tutorial > Commonly used Find command examples under Linux: 33 cases
In the current directory, find all files named linuxprobe.txt
# find . -name linuxprobe.txt ./linuxprobe.txt2. Find files in the home directory
Find all files named linuxprobe.txt in the home directory
# find /home -name linuxprobe.txt /home/linuxprobe.txt3. Find files ignoring the case of file names
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.txt4. Find a specific directory
Look for a directory named linuxprobe in the root directory
# find / -type d -name linuxprobe /linuxprobe5. Find the php file in the specified directory
Find the file named linuxprobe.php in the current directory
# find . -type f -name linuxprobe.php ./linuxprobe.php6. Find all PHP files in the specified directory
# find . -type f -name "*.php" ./linuxprobe.php ./login.php ./index.php7. Find files with permission 777
Find all files with permission 777 in the current directory
# find . -type f -perm 0777 -print8. Find files with permissions other than 777
Find all files in the root directory with permissions other than 777
# find / -type f ! -perm 7779.查找权限为664的文件
# find / -perm 264410.查找到文件大小为100M的文件并删除
# find / -size +100M -exec rm -rf {} \;11.找到SUID文件
# find / -perm /u=s # find / -perm /g=s12.查找文件类型为mp3格式并且大小为100M的文件,然后删除
# find / -type f -name *.mp3 -size +10M -exec rm {} \; #常用find操作,通过find出指定目录下的特定类型特定名称的文件,然后进行修改,移动,删除等操作。13.找到只读文件
# find / -perm /u=r14.找到可执行文件
# find / -perm /a=x15.找到权限为777的文件并改为644
# find / -type f -perm 0777 -print -exec chmod 644 {} \;16.找到权限为777的目录并改为755
# find / -type d -perm 777 -print -exec chmod 755 {} \;17.找到指定的文件并删除
# find . -type f -name "linuxprobe.txt" -exec rm -f {} \;18.找到指定类型的文件并删除
# find . -type f -name "*.txt" -exec rm -f {} \; OR # find . -type f -name "*.mp3" -exec rm -f {} \;19.查找空文件
# find /tmp -type f -empty20.查找空目录
# find /tmp -type d -empty21.查找所有的隐藏文件
# find /tmp -type f -name ".*"22.查找指定用户家目录下的指定文件
# find / -user root -name linuxprobe.txt23.查找指定用户家目录下的所有文件
# find /home -user linuxprobe24.查找指定组中的所有文件
# find /home -group developer25.查找指定用户家目录下的指定文件并忽略大小写
# find /home -user linuxprobe -iname "*.txt"26.查找最近50天修改过的文件
# find / -mtime 5027.查找最近50天被访问过的文件
# find / -atime 5028.查找最近50天到100天之间修改过的文件
# find / -mtime +50 –mtime -10029.查找过去一小时内修改过的文件
# find / -cmin -6030.查找过去一小时内修改过的文件
# find / -mmin -6031.查找过去一小时内被访问过的文件
# find / -amin -6032.查找大小为50M的文件
# find / -size 50M33.查找文件大小在50M-100M之间的文件
# 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!