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编程能力. 正则表达式:使用单个字符串来描述或匹配一系列符合某个句法规则的字符串.通常用来检索和替换那些符合某个模式 ...
随机推荐
- Plastic Sprayers Manufacturer - Ingenious Design Of Spray Plastic Bottle
Plastic bottles are now an indispensable container in life. Plastic bottles will appear in all aspec ...
- Plastic Bottle Manufacturer Tips - Attention To Plastic Bottle Processing Technology
In fact, the processing technology of plastic bottles is actually quite strict. In fact, regular man ...
- jQuery结合CSS实现手风琴组件
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 关于PGSQL连接问题
今天把运维管理服务移植在Linux下测试,但又不想在Linux中安装PGSQL的服务器,就想让运维管理服务在虚拟机中连接windows的PG服务,却发现PG服务器一直拒绝连接,检查了网络端口之后都没问 ...
- LeetCode 79.单词搜索 - JavaScript
题目描述:给定一个二维网格和一个单词,找出该单词是否存在于网格中. 单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中"相邻"单元格是那些水平相邻或垂直相邻的单元格.同一个单 ...
- SpringBoot实现restuful风格的CRUD
restuful风格: 百度百科: RESTFUL是一种网络应用程序的设计风格和开发方式,基于HTTP,可以使用XML格式定义或JSON格式定义.RESTFUL适用于移动互联网厂商作为业务使能接口的场 ...
- MySQL高级-索引1
1.索引是什么 索引(Index)是帮助MySQL高效获取数据的数据结构.可以得到索引的本质:索引是数据结构. 可以理解为“排好序的快速查找数据结构” 在数据之外,数据库系统还维护着满足特定查找算法的 ...
- Redis学习笔记(一)配置文件参数说明
1.Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程 daemonize no 2.当redis以守护进程方式运行时,Redis默认会把pid写入/var/run/ ...
- 阿里云linux挂载磁盘
1)使用fdisk -l命令查看主机上的硬盘 2.使用mkfs.ext4命令把硬盘格式化: mkfs.ext4 磁盘名称 如:mkfs.ext4 /dev/vdb/ 3. 使用mount命令 ...
- HashMap与HashTable源码学习及效率比较分析
一.个人学习后的见解: 首先表明学习源码后的个人见解,后续一次依次进行分析: 1.线程安全:HashMap是非线程安全的,HashTable是线程安全的(HashTable中使用了synchroniz ...