find 基本用法
我们经常要在日常的工作中查找文件,要说linux下最强大的文件查找工具,非find莫属。find可以从文件名、读取修改时间、大小、类型等等来筛选文件,可以完成日常几乎所有的查找需求。
2.大小:
另外,还可以用"+"、"-"来进一步修饰时间和大小的条件:
光找出文件还不够,我们还要对找出的文件进行处理才有意义,一般来讲可以把find的查找结果传递给其他的命令做进一步处理。find本身也提供了许多处理动作的选项。
以上只是find的一些简单的用法,用来应付平日的工作基本足够,想更深入的了解find,可以去探索find的man page。![](/javascripts/fckeditor/editor/images/smiley/msn/wink_smile.gif)
来看一个简单的例子:
find /tmp/ -name 'galeki*'
意思就是在/tmp目录下找出以“galeki”开头的文件,-name指出是对文件名进行筛选,是不是很简单明了?除了文件名,find还有更强大的筛选条件:
1.时间:
参数 | 意义 |
-atime n | 上一次存取时间在n*24小时前以内的文件 |
-ctime n | 上一次状态改变在n*24小时前以内的文件 |
-mtime n | 上一次修改时间在n*24小时前以内的文件 |
-newer file | 比file所指的文件还要新的文件 |
2.大小:
参数 | 意义 |
-size n[bkMG] | 大小为n(b为比特,k为KB,M为MB,G为GB)的文件 |
3.所有者:
参数 | 意义 |
-user name | 所有者用户名称是name的文件 |
-group name | 所有者用户组群名称是name的文件 |
例子:
find /tmp/ -name 'sess*' -mtime 1 #在/tmp目录下找到所有以'sess'开头、并且在一个小时以内修改过的文件
find ./ -name '*.zip' -size 546k #在当前目录下找到所有546KB的zip压缩包文件
find /tmp/ -user 'galeki' #在/tmp目录下找到所有所有者为galeki的文件
find ./ -name '*.zip' -size 546k #在当前目录下找到所有546KB的zip压缩包文件
find /tmp/ -user 'galeki' #在/tmp目录下找到所有所有者为galeki的文件
另外,还可以用"+"、"-"来进一步修饰时间和大小的条件:
find src/ -mtime +2 #找出src目录下上一次修改时间在2天以前的文件
find download/ -size +50M #在download目录下找出大于50M的文件
find download/ -size +50M #在download目录下找出大于50M的文件
光找出文件还不够,我们还要对找出的文件进行处理才有意义,一般来讲可以把find的查找结果传递给其他的命令做进一步处理。find本身也提供了许多处理动作的选项。
常用的处理动作:
参数 | 意义 |
-print |
打印出找出文件的完整地址,一个文件一行 |
-delete |
删除找出的文件 |
-exec command {} \; |
对每一个找到的文件执行command命令,并用文件替换"{}",“\;”是固定的结束符。 |
例子:
find /tmp/ -ctime +7 -delete #删除/tmp目录下一周以前创建的文件
find ./ -name '*.unk' -exec file {} \; #找出当前文件夹下后缀是unk的文件,并用file命令显示每个文件的文件类型
find ./ -name '*.unk' -exec file {} \; #找出当前文件夹下后缀是unk的文件,并用file命令显示每个文件的文件类型
以上只是find的一些简单的用法,用来应付平日的工作基本足够,想更深入的了解find,可以去探索find的man page。
![](/javascripts/fckeditor/editor/images/smiley/msn/wink_smile.gif)
2007年2月24日 17:35
2007年2月24日 21:59
2007年2月25日 00:30 埃。我这段时间一直感冒,发烧,流鼻涕,难受死了。
2007年2月25日 00:53 天……怪不得一直都没见你上来
2007年7月09日 06:32
可不可以有背景音乐的?
2007年7月09日 10:18
暂时没有这个功能,我现在也在考虑是否下一版加入添加自定义代码的功能。
不过怎么发到这里来了![](/javascripts/fckeditor/editor/images/smiley/msn/whatchutalkingabout_smile.gif)
2018年8月08日 15:54
晚上终于腾出时间来折腾了一下,本想复习一下怎么打 patch,结果发现 zen-sources 里面已经有打好 bfs patch 的内核代码了,直接 layman -a zen-overlay 再 emerge zen-sources 就搞定了~
Geometry Dash for free on PC.
2018年9月10日 17:24
Very nice I really like this article.
2018年10月02日 17:14
Wow really interesting article, may later be able to share other helpful information are more interesting. Thank you!
2019年6月29日 14:47
这对于Linux用户来说非常有用。
2019年6月29日 14:50
一个好的操作系统一直是Linux的我。
<a href="https://www.basketballlegends.fun">basketballlegends fun</a>
2019年7月16日 10:32
非常感谢您提供这些精美的蛋糕食谱,我从您的网络博客中学到了很多东西
2019年9月16日 20:18
Thank you very much for the information you provided.
2019年11月18日 17:00
要说linux下最强大的文件查找工具,非find莫属。find可以从文件名、读取修改时间、大小、类型等等来筛选文件,可以完成日常几乎所有的查找需求。
2019年12月06日 11:17
2020年1月21日 17:30
2021年8月18日 16:31
HGH MD is the best and most trusted human growth hormone therapy clinic in Florida and surrounding areas in USA. Our specialists help men and women feel younger and healthier. Call Us Today! 888-763-4221
2021年10月24日 00:40
This is only the internet My organization is choosing all around you. Kudos in your webpage, We add your email your blog. This may be a fine webpage. .
2021年11月03日 20:15
This is only the internet My organization is choosing all around you. Kudos in your webpage, We add your email your blog. This may be a fine webpage. judi qiu qiu online
2021年11月09日 20:29
This is only the internet My organization is choosing all around you. Kudos in your webpage, We add your email your blog. This may be a fine webpage silk pajama set
2021年11月13日 06:19
Your work is very good and I appreciate you and hopping for some more informative posts. Thank you for sharing great information to us. Maombi ya Visa ya Canada Mkondoni
2021年11月14日 05:29
An interesting dialogue is price comment. I feel that it is best to write more on this matter, it may not be a taboo topic however usually individuals are not enough to talk on such topics. To the next. Cheers. helpful hints
2021年11月27日 04:11
If more people that write articles really concerned themselves with writing great content like you, more readers would be interested in their writings. Thank you for caring about your content. 토토커뮤니티
2021年11月28日 05:06
I read that Post and got it fine and informative. 토토사이트
2021年11月29日 19:16
Thanks for every other informative site. The place else may just I get that kind of information written in such an ideal means? I have a venture that I’m just now operating on, and I have been on the look out for such information. 우리카지노
2021年12月03日 00:32
Thank you very much for this great post online24jam
2021年12月04日 04:49
I have recently started a blog, the info you provide on this site has helped me greatly. Thanks for all of your time & work. fiber distribution box
2021年12月04日 04:57
Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. howo truck parts
2021年12月07日 00:12
I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. instagram video downloader
2021年12月18日 04:14
Most of the time I don’t make comments on websites, but I'd like to say that this article really forced me to do so. Really nice post! สมัคร บาคาร่า ออนไลน์
2021年12月19日 05:05
You completed a few fine points there. I did a search on the subject and found nearly all persons will go along with with your blog. outdoor furniture manufacturer
2021年12月19日 05:12
https://docs.google.com/spreadsheets/d/14-2ryq9reJ1tPjuZQvqu0dzwV0ih2Tf3JTOVN3I0VPo/edit#gid=1519259890
2021年12月31日 22:04
This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great. 바카라사이트
2022年1月11日 04:19
I cannot wait to dig deep and kickoff utilizing resources that I received from you. Your exuberance is refreshing. french manicure kit
2022年1月13日 16:37
Thank you very much for writing such an interesting article on this topic. This has really made me think and I hope to read more.
2022年1月17日 03:29
Swim leggings are becoming the solution to many water-sport problems. With Platinum Sun swim leggings, stay warm and protected in the water. swim leggings for women
2022年1月17日 18:25
Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. 메이저사이트 모음
2022年1月18日 14:53
You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. 메이저놀이터모음
2022年1月24日 17:40
I read your blog frequently, and I just thought I’d say keep up the fantastic work! It is one of the most outstanding blogs in my opinion. 토토커뮤니티
2022年2月02日 15:40
This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great. judi online24jam terpercaya 2020
2022年2月07日 06:04
Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. BBL
2022年2月08日 06:19
Pick up the Random Galaxy range of cute, funny t-shirts, posters, tapestries, and shower curtains, featuring space cat designs, sloths, llamas, and loads more options to choose from. sloth t shirt
2022年2月12日 04:14
All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks promotional wine tote
2022年2月15日 22:33
Your work is very good and I appreciate you and hopping for some more informative posts. Thank you for sharing great information to us. qiu qiu online terpercaya
2022年2月20日 06:01
This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! Custom Packaging
2022年2月21日 04:13
I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... Δομημένα Κεντημένα Καπέλα του Μπέιζμπολ
2022年2月27日 18:04
I gotta favorite this website it seems very helpful 500 likes for instagram
2022年3月07日 03:13
Thanks for this great post, i find it very interesting and very well thought out and put together. I look forward to reading your work in the future. rainbow shirt
2022年3月07日 04:19
Wow, this is really interesting reading. I am glad I found this and got to read it. Great job on this content. I like it. taco shirt
2022年3月21日 05:44
Omni Group Australia provide specialized home care services and facility management in Australia. Call us to book an appointment! 040 66 999 69. omni group Australia
2022年3月30日 05:47
Our range of caps and hats look stunning and feel amazing to wear. Feel stylish whatever the occasion, or choose from our range of fine gifts for the special person in your life. bunny hat
2022年3月30日 06:52
Our collapsible laundry baskets are a stylish and convenient addition to your laundry. Designed with functionality in mind, these complete laundry solutions don't take up too much space and can carry any items around your home with ease. wicker laundry baskets
2022年3月31日 06:31
Our broom and mop holders and an ideal way to maximize vertical storage space. Organize the garage, workshop, laundry or shed and easily access your stored items when you need them. push broom
2022年4月02日 05:55
Above 6'2" and just tall? Our tall men's clothing is just for you: the tall lean guy. Organic fabrics. Free shipping. Find your fit now with a tall that fits. Fashion for skinny tall guys
2022年4月03日 04:26
thanks for this usefull article, waiting for this article like this again. slot777 login
2022年4月08日 04:01
Thanks for your insight for your fantastic posting. I’m exhilarated I have taken the time to see this. It is not enough; I will visit your site every day. dpboss
2022年4月09日 05:06
Get best of fun riddles and jokes Riddles with Answers
2022年4月16日 04:53
Experienced and trusted paving contractors in Dublin and wicklow. We offer driveways paving including Resin, tarmac, gravel, cobblestone Driveways Dublin
2022年4月16日 05:13
Everything you should know about resin driveways paving to help you decide on your new driveway by experienced paving contractors in Dublin. Driveways Contractors
2022年4月20日 03:01
Love to read it,Waiting For More new Update and I Already Read your Recent Post its Great Thanks. 2021 sea-doo wake pro 230 for sale
2022年4月22日 09:16
Cool stuff you have and you keep overhaul every one of us
2022年5月07日 05:00
I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. Judi Online
2022年5月14日 23:53
I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon… insurance meaning
2022年6月05日 02:41 It’s appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or advice. Perhaps you could write next articles referring to this article. I desire to read even more things about it! Instagram Mod Apk
2022年6月08日 03:43
You have done a amazing job with you website เค้าไพ่บาคาร่า sa
2022年7月02日 03:28
Thanks for an interesting blog. What else may I get that sort of info written in such a perfect approach? I have an undertaking that I am just now operating on, and I have been on the lookout for such info. corporate office phone number
2022年7月08日 04:16
Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. lunch places near me
2022年7月10日 19:06
Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. GCSE English tutor online
2022年7月12日 22:14
Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks online gcse maths tutor
2022年7月14日 00:41
We provide fashion information on perfect match and close match about the fashion of kdramas I think anyone interested in drama will be wondering what the actor and actress are wearing in the drama and where they can buy similar but reasonably priced products. We have prepared this site to provide such information hometown cha cha cha fashion
2022年7月18日 22:21
Lastingsafe products are used by more than 1,000 international customers, fast global delivery, More than 20 years of production experience, Safe Deposit Box For Sale. Safe Deposit Box Suppliers. safety deposit box supplier
2022年8月16日 03:20
Thanks so much for sharing this awesome info! I am looking forward to see more postsby you! pullman residence
2022年9月29日 02:04
Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also small space workout
2022年10月12日 02:35
I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. youtube smm panel
2023年10月14日 10:51
When it comes to home makeover projects, there's always something fun and exciting about exploring the wealth of decor options you can use to transform your space into something truly your own.
https://www.21newfurniture.com/
ALT Furniture, ALT Outdoor Furniture, ALT Garden - ALT