ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

find学习笔记(1)

2021-02-05 10:01:33  阅读:233  来源: 互联网

标签:文件 xtype Symbolic 笔记 学习 link file find


学习文档:https://www.gnu.org/software/findutils/manual/html_mono/find.html

 

01-Introduction

基本格式:

find [file…] [expression]

 

文件定义

正常文件

目录

符号链接

其他拥有目录项的node

 

find Expressions

options 选项

test 测试

action 行为

operators

 

+n 大于n

-n  小于n

n   等于n

 

02-find files

 

name

 

 

  • i表示忽略大小写
  • glob

  1. name不能包括/
  2. path用来搜索path

Link

Symbolic link: 本身是一个特殊的文件,内容的另外一个文件名

hard link:多个文件名指向同一个文件(inode号),典型的有.和..

 

Symbolic Link的选项

-P:不解析Symbolic Link

-H:只解析命令行中的Symbolic link

-L:解析Symbolic link

对应的test:

-lname

-ilname

symbolic link的内容配置pattern

 

hard link

-samefile Name: 同name的hard link

 

-inum n: inodek的数目为n

 

-links n:hard link数目为n

 

Time

Each file has three timestamps, which record the last time that certain operations were performed on the file:

每个文件有三个时间戳,它记录最后一次操作

  1. access (read the file’s contents) 访问
  2. change the status (modify the file or its attributes) 修改状态
  3. modify (change the file’s contents) 修改内容

Some systems also provide a timestamp that indicates when a file was created.

有些系统也提供文件创建的时间戳

 

reference文件名

-newerXY reference

X: a,B,c, m  ---> 被测试文件

Y:    a,B,c,m, t  ----> reference

t的时候,reference是时间,不是文件

 

Size

-size n[bckwMG]

n大小

bckwMG单位

b->block

c->byte

w->word

-empty

 

Type

-type c

c取值:

b:block(buffer)

c: character(unbuffer)

d: directory

p:named pipe

f: regular file

l: link

s: socket

 

-xtype c

类似type,区别在于文件是symbolic link时候

 

type,先-P,-L,后检查类型

 

xtype的处理很奇怪,l->link, X表示非l

‘‘-P -xtype l’’

True if the symbolic link is broken

 

‘‘-P -xtype X’’

True if the (ultimate) target file is of type ‘X’.

 

‘‘-L -xtype l’’

Always true

‘‘-L -xtype X’’

False unless the symbolic link is broken

 

Owner

File Mode Bits

-readable

-writable

-executable

是指调用的用户有读,写,执行权限

 

-perm pmode

支持数字,符号(a,u,g,o ,r,w,e)

-pem 664

-perm g=rw

 

-: 要求文件的owner,gorup,other权限大于等于指定的权限

/:要求文件owner,gorup,other权限一样满足即可,没有设置忽略

 

Contents

find xxx | xargs grep -l

 

Directories

 

Combining Primaries With Operators

 

优先顺序,从上到下

 

Test: -true

Always true.

 

Test: -false

Always false.

标签:文件,xtype,Symbolic,笔记,学习,link,file,find
来源: https://www.cnblogs.com/fqguo24/p/14376173.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有