Linux运维知识之Linux CentOS 7 中find命令、三个Time、快捷键及file判断文件类型
小标 2018-08-30 来源 : 阅读 1872 评论 0

摘要:本文主要向大家介绍了Linux运维知识之Linux CentOS 7 中find命令、三个Time、快捷键及file判断文件类型,通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助。

本文主要向大家介绍了Linux运维知识之Linux CentOS 7 中find命令、三个Time、快捷键及file判断文件类型,通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助。

一、 find命令locate 查找命令,从本地生成的数据库中查找文件如果没有locate命令,安装软件包:mlocate[root@VM_46_188_centos ~]# which locate /usr/bin/locate
[root@VM_46_188_centos ~]# rpm -qf /usr/bin/locatemlocate-0.26-5.el7.x86_64
[root@VM_46_188_centos ~]#快捷键:ctrl + d 相当然于logout 注销ctrl + l 清屏ctrl + c 中止ctrl + u 删除光标前内容ctrl + K 删除光标后内容ctrl + e 定位光标到最endctrl + a 定位光标到最开始三个time:stat 2.txt 查看2.txt文件的三个timeatime:最近访问内容 cat查看mtime:最近更改内容 echo > /victime 最近改动inode 信息 touch更改了文件内容,mtime ctime 都会变。 更改了文件ctime ,mtime 不会变。[root@VM_46_188_centos ~]# stat 2.txt
  File: ‘2.txt‘
  Size: 0          Blocks: 0          IO Block: 4096   regular empty file
Device: fd01h/64769d Inode: 131211      Links: 1
Access: (0664/-rw-rw-r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2017-07-12 23:21:57.265143288 +0800
Modify: 2017-07-12 23:21:57.265143288 +0800
Change: 2017-07-12 23:21:57.265143288 +0800
 Birth: -
[root@VM_46_188_centos ~]#mv 更名后,ctime 会变:[root@VM_46_188_centos ~]# stat 2.txt
  File: ‘2.txt‘
  Size: 7          Blocks: 8          IO Block: 4096   regular f
ileDevice: fd01h/64769d Inode: 131211      Links: 1
Access: (0664/-rw-rw-r--)  Uid: (    0/    root)   Gid: (    0/    ro
ot)Access: 2017-08-10 21:44:43.123521346 +0800
Modify: 2017-08-10 21:46:39.547587309 +0800
Change: 2017-08-10 21:46:39.649587367 +0800
 Birth: -
[root@VM_46_188_centos ~]# mv 2.txt 22.txt
[root@VM_46_188_centos ~]# stat 22.txt 
  File: ‘22.txt‘
  Size: 7          Blocks: 8          IO Block: 4096   regular f
ileDevice: fd01h/64769d Inode: 131211      Links: 1
Access: (0664/-rw-rw-r--)  Uid: (    0/    root)   Gid: (    0/    ro
ot)Access: 2017-08-10 21:44:43.123521346 +0800
Modify: 2017-08-10 21:46:39.547587309 +0800
Change: 2017-08-10 21:50:32.438719259 +0800find命令:find /etc/ -type d -name "fxq" 查找目录find /etc/ -type f -name "fxq" 查找文件find /etc/ -type c -name "fxq" 查找字符设备文件find /etc/ -type b -name "fxq" 查找块文件find /etc/ -type s -name "fxq" 查找套接字文件find /etc/ -type l -name "fxq" 查找链接文件find / -type f -mtime -1 查找一天内更改过内容的文件find / -type f -mtime +1 查找大于一天更改过内容的文件find /etc/ -type f -o mtime -1 -name "*.conf" (-o 是或者的意思)find / -inum inode号 查找硬链接文件find / -mmin -60 一小时内find / -type f -mmin -120 -exec ls -l {} ; 把所有小于2小时内的文件列出。find / -type f -mmin -1 -exec mv {} {}.bak ;查找出来分钟的文件更名后面加.bakfind / -size +10k -type f -exec ls -l {} ; 列出大于10k文件find / -size +10M -type f -exec ls -l {} ; 列出大于10M的文件find /etc -type f -mtime +1 -mtime -30 查找大于一天小于30天更改过内容的文件。-o 或者举例:[root@VM_46_188_centos ~]# find / -name "my.cnf" -o -name "httpd.conf"/etc/my.cnf/backup/hszd_zabbix/bak/httpd.conf二、 文件名后缀区分大小写后缀名为好识别 .txt .gz .log .confLANG=en 默认是zh_CN.UTF-8中文,要显示中文,系统一定要安装中文支持的语言包。file 查看文件的类型:目录:
[root@VM_46_188_centos ~]# file /bin/
/bin/: directory
[root@VM_46_188_centos ~]#

二进制文件:
[root@VM_46_188_centos ~]# file /bin/cp
/bin/cp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=9c78c9014112530b46143fe598a278c5ad792edb, 
stripped
[root@VM_46_188_centos ~]#

字符设备
[root@VM_46_188_centos ~]# file /dev/pts/0
/dev/pts/0: character special
[root@VM_46_188_centos ~]#

链接文件:
[ec2-user@ip-172-31-29-125 ~]$ ll /usr/sbin/iptables
lrwxrwxrwx. 1 root root 13 Oct 20  2016 /usr/sbin/iptables -> xtables
-multi[ec2-user@ip-172-31-29-125 ~]$ file /usr/sbin/iptables
/usr/sbin/iptables: symbolic link to `xtables-multi‘
[ec2-user@ip-172-31-29-125 ~]$ 

块文件:
[ec2-user@ip-172-31-29-125 ~]$ file /dev/xvda
/dev/xvda: block special
[ec2-user@ip-172-31-29-125 ~]$

套接字文件:
/dev/log
[root@VM_46_188_centos ~]# file /data/mysql/mysql.sock
/data/mysql/mysql.sock: socket
[root@VM_46_188_centos ~]#
[root@VM_46_188_centos ~]# file /dev/log
/dev/log: socket
[root@VM_46_188_centos ~]#

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注系统运维Linux频道!

本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved