day14 find

find命令查找信息补充
查看找文件数据信息:
精确查找:
find 路径信息 -type 文件类型 -name "文件名"
模糊查找:
find 路径信息 -type 文件类型 -name "文件名*"
find 路径信息 -type 文件类型 -name "*文件名"
find 路径信息 -type 文件类型 -name "文*件名"
忽略大小写查找:
find 路径信息 -type 文件类型 -iname "文件名*"
根据数据大小查找数据:
find /oldboy -type f -size +100 --- 找出大于100K的文件
find /oldboy -type f -size -100
find /oldboy -type f -size +1M --- 找出大于1M的文件
`b' for 512-byte blocks (this is the default if no suffix is used)
`c' for bytes (推荐)
`w' for two-byte words
`k' for Kilobytes (units of 1024 bytes) (推荐)
`M' for Megabytes (units of 1048576 bytes) (推荐)
`G' for Gigabytes (units of 1073741824 bytes)
根据目录指定层级进行查找数据(进行递归查找)
[root@oldboyedu oldboy01]# find /oldboy -type f -name "Oldboy*"
/oldboy/oldboy01/Oldboy.txt
/oldboy/Oldboy.txt
[root@oldboyedu oldboy01]# find /oldboy -maxdepth 1 -type f -name "Oldboy*"
/oldboy/Oldboy.txt
[root@oldboyedu oldboy01]# find /oldboy -maxdepth 2 -type f -name "Oldboy*"
/oldboy/oldboy01/Oldboy.txt
/oldboy/Oldboy.txt
[root@oldboyedu oldboy01]# find /oldboy -type f -name "Oldboy*" -maxdepth 1
find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.

/oldboy/Oldboy.txt
根据数据的权限进行查找数据???
根据数据的时间信息查找??? 将30天以前的所有数据进行删除?

posted @ 2019-12-26 15:32  差点肌肉  阅读(142)  评论(0编辑  收藏  举报