Linux运维知识之Linux CentOS7 VMware find命令、文件名后缀
小标 2018-11-26 来源 : 阅读 1796 评论 0

摘要:本文主要向大家介绍了Linux运维知识之Linux CentOS7 VMware find命令、文件名后缀,通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助。

本文主要向大家介绍了Linux运维知识之Linux CentOS7 VMware  find命令、文件名后缀,通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助。

一、find命令
Linux系统中的 find 命令在查找文件时非常有用而且方便。它可以根据不同的条件来查找文件,例如权限、拥有者、修改日期/时间、文件大小等等。在这篇文章中,我们将学习如何使用 find 命令以及它所提供的选项来查找文件。
列出当前目录和子目录下的所有文件
 
[root@davery ~]# find../.bash_logout./.bash_profile./.bashrc./.cshrc./.tcshrc./.ssh
搜索所有文件、目录:find /etc/ -name "xxx*"
root@davery ~]# find /etc/ -name "ssh*"/etc/ssh/etc/ssh/sshd_config/etc/ssh/ssh_config/etc/ssh/ssh_host_rsa_key/etc/ssh/ssh_host_rsa_key.pub/etc/ssh/ssh_host_ecdsa_key/etc/ssh/ssh_host_ecdsa_key.pub[root@davery ~]# 
搜索目录,例子:find /etc/ -type d -name "xxx"
 
 
[root@davery ~]# find /etc/ -type d -name "ssh"/etc/ssh/etc/selinux/targeted/active/modules/100/ssh[root@davery ~]#
搜索文件,例子:find /etc/ -type f -name "xxx"
[root@davery ~]# find -type f -name "*"./.bash_logout./.bash_profile./.bashrc./.cshrc./.tcshrc./.ssh/known_hosts./.bash_history./anaconda-ks.cfg.01./anaconda-ks.cfg.1
根据文件类型搜索文件
[root@davery ~]# find /etc/ -type l
[root@davery ~]# find /etc/ -type d
[root@davery ~]# find /etc/ -type b
[root@davery ~]# find /etc/ -type c
查看文件具体信息,stat 1.txt
[root@davery ~]# ls1.txt  anaconda-ks.cfg.01  anaconda-ks.cfg.1  davery  make  uear1  user1[root@davery ~]# [root@davery ~]# [root@davery ~]# stat 1.txt  文件:"1.txt"  大小:6          块:0          IO 块:4096   目录设备:803h/2051d Inode:652696      硬链接:2权限:(0755/drwxr-xr-x)  Uid:(    0/    root)   Gid:(    0/    root)环境:unconfined_u:object_r:admin_home_t:s0最近访问:2018-03-30 21:57:22.470173086 +0800     Access: -atime最近更改:2018-03-29 00:12:37.656441521 +0800      Modify: -mtime最近改动:2018-03-29 00:17:05.797933042 +0800      Change:-ctime创建时间:-                                                                     Birth[root@davery ~]# 
查看/etc里面1天内更改的信息
[root@davery ~]# find /etc/ type f -mtime -1/etc//etc/resolv.conf/etc/cron.daily/etc/group/etc/gshadow[root@davery ~]#
查看/etc里面60分钟内更改的信息
[root@davery ~]# find /etc/ -type f -mmin -60/etc/resolv.conf/etc/group/etc/gshadow[root@davery ~]#
查找大于1000k文件
 
[root@davery ~]# [root@davery ~]# find /etc/ -type f -size +1000k/etc/udev/hwdb.bin/etc/selinux/targeted/active/policy.kern/etc/selinux/targeted/contexts/files/file_contexts.bin/etc/selinux/targeted/policy/policy.30[root@davery ~]#
查找大于1000k文件并显示大小
 
[root@davery ~]# find /etc/ -type f -size +1000k -exec ls -lh {} \;-r--r--r--. 1 root root 7.2M 3月  23 06:09 /etc/udev/hwdb.bin-rw-r--r--. 1 root root 3.6M 8月   6 2017 /etc/selinux/targeted/active/policy.kern-rw-r--r--. 1 root root 1.4M 8月   6 2017 /etc/selinux/targeted/contexts/files/file_contexts.bin-rw-r--r--. 1 root root 3.6M 8月   6 2017 /etc/selinux/targeted/policy/policy.30[root@davery ~]# 
二、文件名后缀
需要区分大小写
[root@davery ~]# ls1.txt  anaconda-ks.cfg.01  anaconda-ks.cfg.1  davery  make  uear1  user1[root@davery ~]# [root@davery ~]# Ls-bash: Ls: 未找到命令[root@davery ~]#
  

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注系统运维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