2.23find命令(上)
-
几个搜索文件的命令
#which ls
#whereis ls
#locate //这个命令系统中没有// - 需要另外安装
#yum install -y mlocate
总结几个快捷键
#ctrl l //把光标定位到第一行//
#ctrl d //退出,相当于执行了exit //
#ctrl c //直接换行,不执行命令//
#ctrl u //把前面的东西全部删掉//
#ctrl e //把光标定位到最后//
#ctrl a //最光标定位到最前面//
搜索一个知道路径的文件sshd_config
#find /etc/ -name "sshd_config"
搜索一个sshd开头的文件
#find /etc/ -name "sshd"
指定目录搜索
#find /etc/ -type d -name "sshd"
指定类型
#find /etc/ -type f -name "sshd"
软链接文件
#find /etc/ -type l -name "sshd"
b文件
#find /dev/ -type b
c文件
#find /dev/ -type c
2.24find命令(中)
查看文件的具体信息
[user3@centos-01 ~]$ stat 2.txt
文件:"2.txt"
大小:6 块:0 IO 块:4096 目录
设备:803h/2051d Inode:758803 硬链接:2
权限:(0775/drwxrwxr-x) Uid:( 1003/ user3) Gid:( 1003/ user3)
环境:unconfined_u:object_r:user_home_t:s0
最近访问:2017-12-22 14:57:07.174656993 +0800
最近更改:2017-12-22 14:57:07.174656993 +0800
最近改动:2017-12-22 14:57:07.178656917 +0800
创建时间:-
改权限是ctime 改文件内容mtime
访问文件
#cat 2.txt
查找创建或者更改时间是一天以内的文件
#find / etc/ -type f mtime -1
2.25find命令(下)
查找一个文件的硬链接
#find / -inum 33583395
查找一小时内更改过的文件
#find /root/ -type f -nmin -60
查找的同时把所有文件ls -l
#/root/ -type f -nmin -120 -exec ls -l {} \;
查找的同时把所有文件改名字
#/root/ -type f -nmin -120 -exec mv {} {} .bak \;
查找文件大小大于10K的
#find /root/ -size +10k
查找文件大小小于10K的
#find /root/ -size -10k
查找文件大小大于10M的(M要大写)
#find /root/ -size +10M
2.26文件名后缀
相同类型的文件定义相同的后缀名
查看时间
#date
查看语言
#echo $LANG
转载于:https://blog.51cto.com/13242922/2053596