频道栏目
首页 > 资讯 > Linux > 正文

linux系统find命令、文件名后缀

18-06-13        来源:[db:作者]  
收藏   我要投稿

2.23/2.24/2.25 find命令

find 搜索文件的命令which ls:从环境变量 echo $PATH 中找的whereis ls : 可以搜索,搜的不全

安装: locate[root@wangshuang-01 ~]# yum install -y mlocate

模糊搜索:locate +关键字

find /etc/ -name "sshd*"

根据文件的类型搜文件搜目录find /etc/ -type d -name "*.d"

搜文件find /etc/ -type f -name "sshd*"

搜软链接find /etc/ -type l

搜socket文件find /dev/ -type s

搜字符串文件find /dev/ -type c

搜块设备find /dev/ -type b

find / -type -name -mtime -ctime -atimestat 查看文件的具体信息的,名字、大小、块、设备、权限、最近访问、更改时间等

Access:访问文件的时间,cat文件、more文件Modify:修改文件内容Change:修改文件权限,修改文件内容(大小、时间、权限、所有者、所属组)修改文件权限,ctime会变,mtime不会变

更改文件的内容,ctime 一定会变,mtime也会变

访问文件. cat 1.txt ,atime 一定会变

查找在一天以内创建或修改的文件

[root@wangshuang-01 ~]# find / -type f -mtime -1

查找大于一天内创建或修改的文件

[root@wangshuang-01 ~]# find / -type f -mtime +1

查找一天以内在该路径下创建或修改的文件

[root@wangshuang-01 ~]# find /etc/ -type f -mtime -1

/etc/resolv.conf

/etc/group

/etc/gshadow

/etc/shadow

/etc/tuned/active_profile

[root@wangshuang-01 ~]# find /etc/ -type f -atime -1

[root@wangshuang-01 ~]# find /etc/ -type f -ctime -1

添加查找条件,-type,-ctime,-name 是并且的关系

[root@wangshuang-01 ~]# find /etc/ -type f -ctime -1 -name "*.conf"

/etc/resolv.conf

/etc/updatedb.conf

添加的查找条件,-ctime,-name 是或者的关系

[root@wangshuang-01 ~]# find /etc/ -type f -o -ctime -1 -o -name "*.conf"

根据inode号查找硬连接文件

查找60 分钟内创建的文件

[root@wangshuang-01 ~]# find /root/ -type f -mmin -60

/root/1.txt

查找60分钟内创建的文件,并且显示文件的详细信息

[root@wangshuang-01 ~]# find /root/ -type f -mmin -60 -exec ls -l {} \;

-rw-r--r--. 1 777 root 12 Jun 10 20:38 /root/1.txt

查找文件在200分钟内创建,且修改文件名称,在文件名称后加 .bak

查找文件的大小,大于10k,小于10k

[root@wangshuang-01 ~]# find /root/ -type f -size +10k -exec ls -lh {} \;

[root@wangshuang-01 ~]# find /root/ -type f -size -10k -exec ls -lh {} \;

总结:find 常用命令,find -type ,-mtime , -mmin , -size , -o , -exec , -name

2.26 文件名后缀在linux 下面可以自定义文件名及后缀,不能代表文件的类型,修改语言:

相关TAG标签
上一篇:原生pip 与 Anaconda 安装tensorflow 的区别【Windows】
下一篇:使用VMware克隆出来的新虚拟机无法联网问题的解决方法
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站