Linux CentOS7 VMware find命令、文件名后缀
一、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 ~]# ls
1.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 ~]# ls
1.txt anaconda-ks.cfg.01 anaconda-ks.cfg.1 davery make uear1 user1
[root@davery ~]#
[root@davery ~]# Ls
-bash: Ls: 未找到命令
[root@davery ~]#
Linux CentOS7 VMware find命令、文件名后缀的更多相关文章
- Linux CentOS7 VMware usermod命令、用户密码管理、mkpasswd命令
一. usermod命令 usermod可用来修改用户帐号的各项设定 -c, --comment 注释 GECOS 字段的新值 -d, --home HOME_DIR 用户的新主目录 -e, --ex ...
- find命令/文件名后缀
2.23/2.24/2.25 find命令 2.26 文件名后缀 find 搜索文件的命令: which 它是从环境变量中找: [root@centos_1 ~]# which ls alias ...
- 关于linux centos7 vmware 和windows7 文件共享笔记
本方法是以win7,VMware9.0.1 ,centos6.4为基础实验的. 对于linux的初级使用阶段,都会Windows中使用linux虚拟机VMWare或者其它的.在Windows与linu ...
- Linux——CentOS7没有ifconfig命令
前言 今天新安装的centos7,使用ifconfig命令却提示没有,直接安装也没有~ 正文 直接安装直接告诉我这个包不是一个有效的 [root@kafka ~]# yum install -y if ...
- 分享Linux CentOS7 VMware 系统目录结构、 ls命令 、文件类型、alias命令——笔记
一. 系统目录结构 生成目录树结构: tree -a 显示所有 tree -d 仅显示目录 tree -L n n代表数字..表示要显示几层... tree -f 显示完整路径.. yum insta ...
- Linux CentOS7 VMware 环境变量PATH、cp命令、mv命令、文档查看cat/more/less/head/tail——笔记
一.环境变量PATH PATH一个字符串变量,当输入命令的时候LINUX会去查找PATH里面记录的路径. 命令在这几个目录里面就不需要敲绝对路径 echo $PATH 例子:把/tmp/ 加到 $PA ...
- Linux CentOS7 VMware 相对和绝对路径、cd命令、mkdir/rmdir、rm命令——笔记
一. 相对和绝对路径 绝对路径是从/(也被称为根目录)开始的,比如/usr.cd /root/ pwd 注:判断用户当前所处的位置 相对路径是以 . 或 .. 开始的 二.cd命令 cd 是进入到当前 ...
- Linux CentOS7 VMware 安装软件包的三种方法、rpm包介绍、rpm工具用法、yum工具用法、yum搭建本地仓库
一.安装软件包的三种方法 Linux下游三种安装方法,rpm工具.yum工具.源码包.rpm按装一个程序包时,有可能因为该程序包依赖另一个程序包而无法安装:yum工具,可以连同依赖的程序包一起安装. ...
- Linux CentOS7 VMware正则介绍、grep工具、egrep表达式
一.正则介绍 正则是学习shell脚本的必学的内容,正则学的好坏直接影响到shell编程能力. 正则表达式:使用单个字符串来描述或匹配一系列符合某个句法规则的字符串.通常用来检索和替换那些符合某个模式 ...
随机推荐
- Eclipse Tomcat 7.0 添加WEB项目报错:Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules
前言 我叫梅乾花,我误闯了“从零开始的程序世界”,遭受到了前所未有的的困难,为了活下去,为了看见美好的明天,我开始学习之旅. 问题篇我打开了"Eclipse",将项目导入其中,开启 ...
- JAVA(1)之关于对象数组作形参名的方法的使用
public class Test{ int tour; public static void cs(Test a[]) { for (int i = 0; i < a.length; i++) ...
- idea中springboot静态资源及页面跳转问题
1,静态资源放在resources/static下,html页面放在resources/templates下 2,在html中引入静态资源时,不用带static(对于路径来说是透明的) 3, 配置ht ...
- java调用exe
前言:最近做了一个Java跨平台开启,关闭,重启nginx的功能,在Java操作exe上遇到了一些问题,下面是对这个问题一个总结 一.Java操作exe的三种方式 (1)Runtime.getRunt ...
- 5G新时代开启,你会选择哪家运营商?
牌照正式发放后,5G新时代正式来临.而5G时代显然开了个好头,B站UP主"老师好我叫何同学"发布的<有多快?5G在日常使用中的真实体验>视频,引爆全网.除了仅在B站就获 ...
- windows下mysql 8.0.12安装步骤及基本使用教程
本文实例为大家分享了windows下mysql 8.0.12安装步骤及使用教程,供大家参考,具体内容如下 补充:mysql 已经更新到了 8.0.19,大致步骤和这个差不多,照着来就完事了. 我下载的 ...
- string类的具体实现
bigThree,注意拷贝构造函数的写法. #ifndef __MYSTRING__ #define __MYSTRING__ class String { public: String(); Str ...
- ECS 系统 Entity-Component-System
已经推出了很久了, 貌似也有一些人开始使用, 我是在看守望先锋的程序设计相关文章的时候看到 ECS 的, 从它的设计逻辑上看, 核心就是 Composition over inheritance (o ...
- SI架构设计与实践
拆分数据表 水平拆分: 水平拆分 路由算法 pavarotti17 f(pavarotti17) 路由算法——扩容 路由算法——非均匀分布 拆分表的数据访问——SQL转发 si的策略 MySQL集群替 ...
- postgres语句
select DISTINCT lxbh from "20190816183245_ld_lxbh_2018" WHERE CHAR_LENGTH("lxbh" ...