- 知识1
which 是查询环境变量范围内用的 whereis 根据库里边搜索每天定期更新 locate 需要安装mlocate 包 库凌晨4点生成 也可以update 手动升级
- 知识2 stat 查看文件信息 ctrl l 命令首行 ctrl c 取消 ctrl u 删除光标前的 ctrl d 删除后边一位 ctrl a 光标最前边 ctrl e 光标最后边 ctrl k 删除光标后的
- mtime、ctime、atime atime 在文件读取或者执行 时间变化 mtime 文件改动 时间变化 ctime 写入文件更改权限 (inode 变化而变化)
- 实验
[root@LinuxA tmp]# stat yum.log //查看时间
File: 'yum.log'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 803h/2051d Inode: 16777289 Links: 1
Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 1002/ user)
Access: 2017-10-15 00:45:58.658004152 +0800
Modify: 2017-10-15 00:45:58.658004152 +0800
Change: 2017-10-19 15:43:24.541251270 +0800
Birth: -
[root@LinuxA tmp]# cat yum.log //cat yum.log
[root@LinuxA tmp]# stat yum.log // 验证下 access 是否变化
File: 'yum.log'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 803h/2051d Inode: 16777289 Links: 1
Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 1002/ user)
Access: 2017-10-24 18:57:59.487465246 +0800
Modify: 2017-10-15 00:45:58.658004152 +0800
Change: 2017-10-19 15:43:24.541251270 +0800
[root@LinuxA tmp]# vi yum.log //编辑下 写入东西
[root@LinuxA tmp]# stat yum.log // mtime 和ctime 变化
File: 'yum.log'
Size: 18 Blocks: 8 IO Block: 4096 regular file
Device: 803h/2051d Inode: 16777289 Links: 1
Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 1002/ user)
Access: 2017-10-24 18:57:59.487465246 +0800
Modify: 2017-10-24 19:00:23.642155123 +0800
Change: 2017-10-24 19:00:23.643155087 +0800
##find命令 find -nanme 名字匹配 -type 文件 类型 -type d 目录匹配 -type f 文件 -type s socket 问题就 -type l 软连接文件 -type c 字符串设备 -type b 块设备 -mtime 创建或者更改时间 +1 大于一天 -1 小于一天 -o 或者 -size -10k 小于10k k 小写 -size +200M 大于200M M 大写 -inum 1234 根据inode 查询 文件 -mmin -60 一小时(60分钟)以内
实验
[root@LinuxA tmp]# find /etc -type f -mmin -600 -exec ls -l {} {} \; // ls -l etc 下小于600 分钟的 exec 表示结果输出后 {} {} 表示匹配文件 \ 脱意符 ;结尾
[root@LinuxA tmp]# find / -type f -size +30M //大于30M
/boot/initramfs-0-rescue-ab634188e44145c5851828cd24c1444e.img
/proc/kcore
##文件后缀名 gz 压缩文件 conf 配置文件 txt 文本 ##linux 和window 相互传文件 xshell securecet 2个软件
[root@LinuxA ~]# #yum install lrzsz // 安装包 sz a.txt linux 传电脑 rz 回车 选文件 电脑传liunx