Today's the day

向软件大牛炫耀我会焊单片机,向硬件大牛炫耀我会写 Rails,向软硬件大牛炫耀我生物,向软硬件生物大牛炫耀我会折腾期货 -_-bbb

体验了一把Virtual Box

find 基本用法

galeki posted @ 2007年2月24日 00:44 in Linux with tags linux find , 7909 阅读
我们经常要在日常的工作中查找文件,要说linux下最强大的文件查找工具,非find莫属。find可以从文件名、读取修改时间、大小、类型等等来筛选文件,可以完成日常几乎所有的查找需求。

来看一个简单的例子:

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 src/ -mtime +2            #找出src目录下上一次修改时间在2天以前的文件
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的一些简单的用法,用来应付平日的工作基本足够,想更深入的了解find,可以去探索find的man page。
Avatar_small
galeki 说:
2007年2月24日 21:59
引用来自:lyanry @ 2007年02月24日 09:35AM
呵呵,这两天我每天夜里4点睡,12点起
Avatar_small
lyanry 说:
2007年2月25日 00:30 埃。我这段时间一直感冒,发烧,流鼻涕,难受死了。
Avatar_small
galeki 说:
2007年2月25日 00:53 天……怪不得一直都没见你上来
Avatar_small
loybbb 说:
2007年7月09日 06:32

可不可以有背景音乐的?

Avatar_small
galeki 说:
2007年7月09日 10:18

暂时没有这个功能,我现在也在考虑是否下一版加入添加自定义代码的功能。

不过怎么发到这里来了

Geony 说:
2018年8月08日 15:54

晚上终于腾出时间来折腾了一下,本想复习一下怎么打 patch,结果发现 zen-sources 里面已经有打好 bfs patch 的内核代码了,直接 layman -a zen-overlay 再 emerge zen-sources 就搞定了~

 

Geometry Dash for free on PC.

 

superfighters 说:
2018年9月10日 17:24

Very nice I really like this article.

bubble shooter 说:
2018年10月02日 17:14

Wow really interesting article, may later be able to share other helpful information are more interesting. Thank you!

basketball 说:
2019年6月29日 14:47

这对于Linux用户来说非常有用。

basketball 说:
2019年6月29日 14:50

一个好的操作系统一直是Linux的我。

<a href="https://www.basketballlegends.fun">basketballlegends fun</a>

run 3 online 说:
2019年7月16日 10:32

非常感谢您提供这些精美的蛋糕食谱,我从您的网络博客中学到了很多东西

darellkasper 说:
2019年9月16日 20:18

Thank you very much for the information you provided.

basketball legends 说:
2019年11月18日 17:00

要说linux下最强大的文件查找工具,非find莫属。find可以从文件名、读取修改时间、大小、类型等等来筛选文件,可以完成日常几乎所有的查找需求。

Lenny Drew 说:
2019年12月06日 11:17
It’s encouraging to see writing like this online. I respect the work you do and the effort you have to put into getting this kind of material ready to write. Feel free to surf my site: 벳컨솔루션
 
email login 说:
2020年1月21日 17:30
There are many reasons that might prevent you from signing in email normally,  email login is created to help you solve all sign in problem.
SEO 说:
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

best helpdesk ticket 说:
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. .

Harry 说:
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

Harry 说:
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

Maombi ya Visa ya Ca 说:
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

Iarratas ar Víosa Ch 说:
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. 토토사이트

Harry 说:
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. 우리카지노

Harry 说:
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

Harry 说:
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

Harry 说:
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. 바카라사이트

french manicure 说:
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

BuildNow GG 说:
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

HGDFFH 说:
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. 메이저사이트 모음

HGDFFH 说:
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. 메이저놀이터모음

COOK 说:
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. 토토커뮤니티

Harry 说:
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

Harry 说:
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... Δομημένα Κεντημένα Καπέλα του Μπέιζμπολ

Harry 说:
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月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

ทางเข้า ufabet888 说:
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

principle of insuran 说:
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年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

Hospitality rota sof 说:
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

Hospitality rota sof 说:
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

hometown cha cha cha 说:
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

vault door manufactu 说:
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

passii 说:
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


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter