2019独角兽企业重金招聘Python工程师标准>>>

9月18日任务

2.23/2.24/2.25 find命令

2.26 文件名后缀

2.23 、find命令 :文件搜索命令

#跟find相关的几个文件搜索命令

which         #根据PATH查询命令位置。whereis      #搜索命令及文件位置,搜索不全面,不常用。locate          # yum install -y mlocate   这个命令需要用yum源安装,安装完需要同步数据库,运行updatedb 同步。

常用快捷键介绍:

  • ctrl +d       关闭窗口 相当于logou
  • ctrl +l       清屏 相当于命令clear
  • ctrl +u       快捷删除已经输入光标前的内容
  • ctrl +c       结束当前操作
  • ctrl +a       光标移动至首位
  • ctel +e       光标移至末尾

find命令用法介绍

[root@zgxlinux-01 ~]# find /etc/ -name "ssh_config"           #按文件路径和文件名搜索
/etc/ssh/ssh_config[root@zgxlinux-01 ~]# find /etc/ -name "sshd*"                  #模糊搜索,以sshd起始的命名文件都搜索出来
/etc/pam.d/sshd
/etc/systemd/system/multi-user.target.wants/sshd.service
/etc/sysconfig/sshd
/etc/ssh/sshd_config[root@zgxlinux-01 ~]# find /etc/ -type d -name "sshd*"    #搜索etc下的目录,命名以sshd起始的目录,搜索出来没有。
[root@zgxlinux-01 ~]# find /etc/ -type f -name "sshd*"     #搜索etc下的文件,命名以sshd起始的目录。
/etc/pam.d/sshd
/etc/sysconfig/sshd
/etc/ssh/sshd_config

find -type 常用选项:

  • find -type d -name  #目录
  • find -type f -name   #文件
  • find -type l -name    #软链接
  • find -type s -name    #soukt文件
  • find -type b -name  #块设备文件
  • find -type c -name   #字符串设备

2.24 、find命令(中)

命令 :stat    查看文件信息

[root@zgxlinux-01 ~]# stat anaconda-ks.cfg文件:"anaconda-ks.cfg"大小:2557          块:8          IO 块:4096   普通文件
设备:803h/2051d    Inode:33582978    硬链接:1
权限:(0600/-rw-------)  Uid:(    0/    root)   Gid:(    0/    root)
环境:system_u:object_r:admin_home_t:s0
最近访问:2018-09-04 13:07:34.796488030 +0800
最近更改:2018-09-04 13:07:34.796488030 +0800
最近改动:2018-09-04 13:07:34.796488030 +0800
创建时间:-
  • find -mtime   最近更改(内容)工作中常用
  • find -atime    最近访问
  • find -ctime    最近改动(inode、权限、文件名)
[root@zgxlinux-01 ~]# find /etc/ -type f -mtime -1     #搜索/etc/下载一天内修改过的文档。
/etc/resolv.conf
/etc/tuned/active_profile
/etc/tuned/profile_mode
[root@zgxlinux-01 ~]# find /etc/ -type f -mtime -1 -name "*.conf"    #搜索/etc/下是文件并且修改时间在1天以内并且以.conf结尾的文件
/etc/resolv.conf
[root@zgxlinux-01 ~]# find /etc/ -type f -o -mtime -1 -o -name "*.conf"   #-o表示或者 ,三个条件只需要满足一个即可。用法少。

2.25 、  find命令(下)

#常用选项:find -type文件类型   、find -mtime 多少天内 、  find -mmin 多少分钟 、 find  -exec匹配使用

#如何查找硬链接文件   find -inum 按照inode号查找硬链接文件。

[root@zgxlinux-01 ~]# ln 1.txt /tmp/1.txt.bak
[root@zgxlinux-01 ~]# ls -i 1.txt
33583024 1.txt
[root@zgxlinux-01 ~]# find / -inum 33583024
/root/1.txt
/tmp/1.txt.bak
[root@zgxlinux-01 ~]# find /root/ -type f -mmin -2000       #查找root下文件修改时间在2000分钟以内的文件
/root/.bash_history
/root/1.txt
[root@zgxlinux-01 ~]# find /root/ -type f -mmin -2000 -exec ls -l {} \;        #查找文件的同时列出详细信息
-rw-------. 1 root root 23886 9月  17 17:48 /root/.bash_history
-rw-r--r--. 2 root root 0 9月  17 15:00 /root/1.txt[root@zgxlinux-01 ~]# find /root/ -type f -mmin -2000 -exec mv {} {}.bak \;        #查找文件的同时修改文件名
[root@zgxlinux-01 ~]# find /root/ -type f -mmin -2000
/root/.bash_history.bak
/root/1.txt.bak

2.26 、文件后缀名

#Linux文件后缀名不严格区分,给文件添加后缀的目的是为了方便区分。

转载于:https://my.oschina.net/u/3959708/blog/2054705

find命令日常用法和文件名后缀相关推荐

  1. find的命令的使用和文件名的后缀

    find的命令的使用和文件名的后缀 除了find  还有其他的搜索命令,不过没有find功能强大,了解即可 ! root@alex ~]# which pwd /usr/bin/pwd [root@a ...

  2. linux命令拉取windows的文件,find命令、文件名后缀以及Linux和Windows互传文件(示例代码)...

    find命令 文件查找: 1.which(一般用于查找命令的绝对路径) 2.whereis(不常用) 3.locate(非实时查找,基于预先定义的数据库.模糊查找,查找速度快.使用前要先安装这个命令y ...

  3. find命令 文件名后缀

     find命令 1.查看当前目录下以.txt结尾的文件 [root@test ~]# find . -name "*.txt" ./.subversion/README.txt . ...

  4. find命令及文件名后缀

    1. find命令 常见的搜索命令有:which.whereis.locate.find. locate命令可以通过"yum install -y mlocate"来安装,如果在安 ...

  5. python basename_我使用过的Linux命令之basename - 去掉文件名的目录和后缀

    我使用过的Linux命令之basename - 去掉文件名的目录和后缀 用途说明 basename命令用于去掉文件名的目录和后缀(strip directory and suffix from fil ...

  6. linux判断文件名结尾,find命令 文件名后缀

    find命令 1.查看当前目录下以.txt结尾的文件 [root@test ~]# find . -name "*.txt" ./.subversion/README.txt ./ ...

  7. java获取文件名后缀方法

    Java是一种应用广泛的编程语言,可以通过多种方式来实现对文件的操作.如文件名后缀.文件扩展名等.今天我们来看下 Java是如何获取文件名后缀的吧! 1.打开一个空文件,将其复制到一个新的文件夹中. ...

  8. linux 服务器 日常命令 日常需求

    linux 服务器 日常命令 日常需求 文件管理 文本筛选-grep 截取字段-awk 对文件内容修改-sed 查找 下载文件 Http请求 上传 下载 压缩 解压 排序去重-sort.uniq 数值 ...

  9. Linux 命令行中的文件名/文件路径中使用通配符的说明

    文章目录 支持通配符 通配符表达式示例 通配符使用限制 使用通配符表示的路径示例 带有空格的通配符或文件名必须加上引号 支持通配符 * 表示任意数量的任意字符 ? 表示任意单个字符 通配符表达式示例 ...

  10. [vue] 为什么我们写组件的时候可以写在.vue里呢?可以是别的文件名后缀吗?

    [vue] 为什么我们写组件的时候可以写在.vue里呢?可以是别的文件名后缀吗? 也可以写为js,jsx,ts,tsx这种 个人简介 我是歌谣,欢迎和大家一起交流前后端知识.放弃很容易, 但坚持一定很 ...

最新文章

  1. 一起谈.NET技术,在.NET Workflow 3.5中使用多线程提高工作流性能
  2. 【caffe】create_cifar10.sh在windows下解决方案
  3. 系统管理员必学的30个Linux实用命令
  4. 处理测试环境硬盘爆满
  5. pb blob存储到image_【Filecoin相关】速懂 Filecoin 自认证存储设计
  6. Netty工作笔记0046---TaskQueue自定义任务
  7. matlab切割肿瘤算法,ML之RF:基于Matlab利用RF算法实现根据乳腺肿瘤特征向量高精度(better)预测肿瘤的是恶性还是良性...
  8. iPhone开发:类似iChat的聊天泡泡
  9. 有点累了?不如看看兵法三十六计。
  10. Unity基础知识学习四,UI框架设计
  11. 景区门票预约系统如何开发
  12. 【黑马程序员西安中心】一个内向青年的转变
  13. 大数据最核心的价值是什么?
  14. Vallen Dispersion——计算Lamb波色散,声发射信号模态分析的免费软件
  15. 实验二:交换机基本配置
  16. 数据库课程设计-在线图书馆
  17. Kafka + ELK实现日志采集
  18. 打印机八大常见共性故障解决方法
  19. 基于元胞自动机的森林火灾matlab模拟
  20. 【沐风老师】3DMAX一键PVC窗户生成器插件使用方法详解

热门文章

  1. Atitit 机器可读护照的Machine-readable passport 规范与解析格式 目录 1. 术语 1 1.1. machine-readable zone(MRZ) 1 1.2.
  2. Atitit 搜索蓝牙设备 powershell的实现 java noede.js python 先用脚本语言python nodejs,不好实现。。Java 也不好实现。。 Netcore可以,
  3. Atitit 计算软件简史 艾提拉著 目录 1.1. 第二代软件(1959~1965) 高级语言 第三代软件(1965~1971) os 1 1.2. 第四代软件(1971~1989)结构化的程序
  4. Atitit 面试流程法 艾提拉总结 增加企业黑名单制度,出去前核对黑名单 免得白跑 增加白名单制度,统计分析号面试的企业,垃圾企业 中等分类 1.面试提前给指导人参考 具体分析企业性质 产
  5. Atiitt 自我学习法流程 1.预先阶段 1.1.目标搜索 资料搜索 1.2. 1.3.通过关联关键词 抽象 等领域 拓展拓宽体系树 1.4. 2.分析整理阶段 2.1.找出重点 压缩要学会
  6. Atiitt uke兼wag集团2017年度成果报告总结 attilax著 1. 组织机构进一步完善 8大首席部门 1 2. 事业部进一步完善,以及一百多个事业部了 1 3. 企业文化进一步完善 1
  7. titit 切入一个领域的方法总结 attilax这里,机器学习为例子
  8. Atitit onvif 协议截图 getSnapshotUri 使用java
  9. Atitit .h5文件上传
  10. paip.环境设置 mybatis ibatis cfg 环境设置