2.23/2.24/2.25 find命令
find 搜索文件的命令which ls:從環境變量 echo $PATH 中找的whereis ls : 可以搜索,搜的不全
模糊搜索:locate +關鍵字
find /etc/ -name “sshd*”
[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號查找硬連接文件
[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
[root@wangshuang-01 ~]# find /root/ -type f -size +10k -exec ls -lh {} ;
[root@wangshuang-01 ~]# find /root/ -type f -size -10k -exec ls -lh {} ;
2.26 文件名后綴在linux 下面可以自定義文件名及后綴,不能代表文件的類型,修改語言: