This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12240|Reply: 0

[linux] Find command in Linux - Find file name

[Copy link]
Posted on 5/21/2015 11:32:13 PM | | |

1. Find the file named "elm.cc" in a certain directory
find /home/lijiajia/ -name elm.cc

2. Find files that contain a certain character (e.g. "elm") in the file name
find /home/lijiajia/ -name '*elm*'
find /home/lijiajia/ -name 'elm*'
find /home/lijiajia/ -name '*elm'

3. Query according to the characteristics of the document
find /home/lijiajia/ -amin -10 #查找在系统中最后10分钟访问的文件
find /home/lijiajia/ -atime -2 #查找在系统中最后48小时访问的文件
find /home/lijiajia/ -empty #查找在系统中为空的文件或者文件夹
find /home/lijiajia/ -group cat # Find files that belong to groupcat in the system (I tried, the command is wrong. )
find /home/lijiajia/ -mmin -5 # Find files that have been modified in the last 5 minutes in the system
find /home/lijiajia/ -mtime -1 #查找在系统中最后24 hours of modifications
find /home/lijiajia/ -nouser #查找在系统中属于作废用户的文件 (don't understand what it means)
find /home/lijiajia/ -amin 10 #查找在系统中最后10分钟访问的文件
find /home/ftp/pub -user lijiajia #查找在系统中属于lijiajia这个用户的文件
(PS: The above are all operations performed under the /home/lijiajia/ folder)

4. Use a hybrid lookup to find files
find /tmp -size +10000000c -and -mtime +2 A file in the #查找/tmp directory that is larger than 100000000 bytes and modified within 48 hours
Find files belonging to either tom or George in the /tmp directory #查找/tmp
find /tmp ! -usr fred #查找/tmp directory that does not belong to fred

5. Find and display the file
Find /home/lijiajia/ -name 'elm.cc' -ls #在目录下查找名为 the "elm.cc" files and display the information for those files




Previous:EXTMAIL admin password recovery
Next:Linux builds VPN, PPTPD one-click installation script
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com