查找文件之find locate

####find########

find 命令

find 路径 条件 条件值

find /mnt -name file                       ##查找名为file的文件

[root@localhost Desktop]# ls

[root@localhost Desktop]# touch file{1..8}

[root@localhost Desktop]# find / -name file3

/root/Desktop/file3

find /mnt -name "file*"                   ##查找所有文件名以file开头的所有文件


find /etc -name "*.conf"                ##查找所有包含.conf的文件


find / -user liu                              ##查找用户liu


find / -group groupname            ##查找名为groupname的组

find 条件1 -o 条件2                    ##满足条件1或条件2的

[root@localhost mnt]# find / -size 0 -name file2
/root/Desktop/file2

find    -type  文件类型                ##查找属于文件类型的文件

find -mmin +|-数字                     ##时间

  -maxdepth levels
              Descend at most levels (a non-negative integer) levels of direc‐
              tories below the command line arguments.  -maxdepth 0
               means only apply the tests and  actions  to  the  command  line
              arguments.
       -mindepth levels
              Do  not apply any tests or actions at levels less than levels (a
              non-negative integer).  -mindepth  1  means  process  all  files
              except the command line arguments.
       -mount Don't  descend  directories  on other filesystems.  An alternate
              name for -xdev, for compatibility with some  other  versions  of
              find.

dd if=/dev/zero of=/mnt/file bs=1024 count=10##

            dd                                 ##数据截取

             if                                  ##数据模板

            of                                  ##数据存放文件

            bs                                 ##数据快大小(block size)

            count                            ##数据快个数

--size 数字|-数字|+数字             ###查找大小符合条件的文件

-maxdepth 数字                        ###最深目录层

-mindepth 数字                        ###最小目录层

-exec 命令 {} \;                        ###对查找出的结果做相应处理 


推荐网址:http://man.linuxde.net/find

########locate###########

locate +条件                            ##在数据库中查找符合条件的文加

updatedb                                 ##更新数据库

 例子:

[root@localhost Desktop]# ls
file1  file2  file3  file4  file5  file6  file7  file8
[root@localhost Desktop]# locate file3
[root@localhost Desktop]# updatedb
[root@localhost Desktop]# locate file3
/root/Desktop/file3

5.链接

#######硬链接#########

硬链接是文件的副本,为了节省设备节点号

ln 文件 链接

 

######软链接############

软链接时文件的快捷方式,为了节省设备存储快

ln -s  文件  链接

 

  ls -i                   ##查看一个文件节点号

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值