Loading
0

Linux命令-vim文本编辑器|文件查找

updatedb    ----更新数据库表
查找速度快,但是如果有新文件,需要更新数据库表才能找到,locate 不会到/tmp /var/tmp 临时目录查找数据。
2、find    ----文件查找  支持多种查找方式
-name   ----以文件名作为查找方式                 -type   ----以文件类型
-user   ----用户                                 -group  ----组
-perm   ----权限                                 -uid    -gid
-atime  ----根据访问时间查找
find / -atime -3    ----查找3天内被访问过的文件 ‘-’ 代表天数之内
-ctime  ----根据改变属性时间查找
find / -ctime +15   ----查找15天前被改变属性的文件
-mtime  ----根据改变文件内容时间查找
-maxdepth   ----查找的最大路径
[root@bogon Desktop]# find /etc/-maxdepth 1 -name '*.conf'
/etc/resolv.conf    ----在/etc下一级路径内查找*.conf的文件
/etc/libuser.conf
/etc/idmapd.conf
/etc/asound.conf
/etc/e2fsck.conf
/etc/mke2fs.conf
/etc/mtools.conf
/etc/sestatus.conf
/etc/host.conf
/etc/ld.so.conf
/etc/request-key.conf
/etc/nsswitch.conf
-mindepth   ----查找的最小路径
-regex      ----支持正则表达式查找
-empty      ----内容为空的文件
-fstype     ----根据不同的文件系统类型
-inum       ----根据inode节点编号(查找硬链接inode相同)
-newer file1 ! file2 查找更改时间比文件file1新但比文件file2旧的文件。
-readable   ----可读文件
-writeable  ----可写文件
-samefile name ----同inum inode编号找出 ,samefile 文件名称,inum找相同inum的文件名
-size n[cwbkMG]     ----根据文件大小查找
eg:find / -size +1G    ----查找大于1G的文件
find / -size -4k    ----查找小于4k的文件
‘+’   大于
‘-’    小于
File uses n units of space.  Thefollowing suffixes can be used:

‘b’    for 512-byte blocks (thisis the default if no suffix is used)

‘c’    for bytes

‘w’    for two-byte words

‘k’    for Kilobytes (units of1024 bytes)

‘M’    for Megabytes (units of1048576 bytes)

‘G’    for Gigabytes (units of1073741824 bytes)

3、find / -user kiosk -exec cp {} /tmp/kiosk -a \;
-exec 将find找到的结果交给后面的cp命令处理
\    ----代表转义
;  ----代表命令结束

4、find / -size 1000c -ok {} /var/tmp/ \;      ----ok  交互式询问

分页阅读: 1 2
【声明】:8090安全小组门户(https://www.8090-sec.com)登载此文出于传递更多信息之目的,并不代表本站赞同其观点和对其真实性负责,仅适于网络安全技术爱好者学习研究使用,学习中请遵循国家相关法律法规。如有问题请联系我们:邮箱hack@ddos.kim,我们会在最短的时间内进行处理。