编辑,文件查找

inode只能记录本分区的文件信息,硬链接不能跨分区
[yuq@localhost ~]$ which ifconfig
/usr/sbin/ifconfig
[yuq@localhost ~]$ which ifconfig
/usr/sbin/ifconfig
[yuq@localhost ~]$ which date
/usr/bin/date
[yuq@localhost ~]$ which vim
/usr/bin/vim
[yuq@localhost ~]$ whereis vim
vim: /usr/bin/vim /usr/share/vim /usr/share/man/man1/vim.1.gz
#查看编码
[yuq@localhost ~]$ locale
#指定编码打开fireforx
LANG=en_US.UTF-8 firefox
#默认编码
[yuq@localhost ~]$ cat /etc/locale.conf
LANG="zh_CN.UTF-8"
#locate查询文件
[yuq@localhost ~]$ locate /home/yuq/test/
/home/yuq/test/file1
/home/yuq/test/hosts
/home/yuq/test/passwd
/home/yuq/test/services
#更新数据库
[yuq@localhost ~]$ updatedb
#find 文件查询
[yuq@localhost ~]$ find /home/ -user yuq
#-a 和&的意思
[yuq@localhost ~]$ find /home/ -user yu -a -user tom
#-o 或||的意思
[yuq@localhost ~]$ find /home/ -user yu -a -user tom
#没有所以者的文件,用户被删除
[yuq@localhost ~]$ find -nouser
#查询所有者的文件
[yuq@localhost ~]$ find -uid 1000
#创建文件
[yuq@localhost test]$ dd if=/dev/zero of=file1 bs=1M count=1
[yuq@localhost test]$ dd if=/dev/zero of=file2 bs=1M count=2
[yuq@localhost test]$ dd if=/dev/zero of=file3 bs=1M count=3
#查询文件等于2M
[yuq@localhost test]$ find -size 2M
#查询文件小于5M
[yuq@localhost test]$ find -size -5M
#查询文件小于3M或者等于3M
[yuq@localhost test]$ find -size -3M -o -size 3M
#查询文件大于3M或者等于3M
[yuq@localhost test]$ find -size +3M -o -size 3M
#查询时间小于一天的文件
[yuq@localhost test]$ find -mtime -1
#查询时间大于一分钟的文件
[yuq@localhost test]$ find -mmin +1
#查询文件权限文件
[yuq@localhost test]$ find -perm 435
[yuq@localhost test]$ find -perm /435
#查询文件并删除
find -name *file** -exec rm -rf {} \;
#指定文件深度查询

 

posted on 2017-06-14 13:03  ZGCOS  阅读(127)  评论(0)    收藏  举报

导航