zoukankan      html  css  js  c++  java
  • linux基础之find命令常用用法

    一、根据文件名查找文件

    • 1.在当前目录中根据文件名(完整文件名)查找文件(若是目录文件,则打印目录下所有文件)
      只是在当前目录查找,不会遍历当前目录下的目录文件
    #在当前目录查找1.c文件
    linux@ubuntu:~$ find 1.c
    1.c
    #在当前目录查找后缀为.txt的所有文件
    linux@ubuntu:~$ find *.txt
    testtest.txt
    test.txt
    #在当前目录查找以test开头的所有文件
    linux@ubuntu:~$ find test*
    test
    test/inc
    test/inc/match_bmp.h
    test/inc/touch.h
    test/inc/bmp.h
    test/bin
    test/bin/main
    test/src
    test/src/touch.c
    test/src/bmp.c
    test/src/match_bmp.c
    test/src/main.c
    test/Makefile
    testtest.txt
    test.txt
    
    • 2.查找指定目录下的文件
    #在当前目录下的test/src/目录查找后缀为“.c”的所有文件
    linux@ubuntu:~$ find test/src/ -name '*.c'
    test/src/touch.c
    test/src/bmp.c
    test/src/match_bmp.c
    test/src/main.c
    
    • 3.使用名称和忽略案例查找文件
    #在当前目录找到名称为test的所有文件,不区分大小写
    linux@ubuntu:~/test$ find ./ -iname test
    ./Test
    ./test
    
    • 4.使用名称查找.c文件
    #在当前工作目录中查找所有.c文件。
    linux@ubuntu:~/test$ find ./ -type f -name '*.c'
    ./src/touch.c
    ./src/bmp.c
    ./src/match_bmp.c
    ./src/main.c
    ./bmp.c
    
  • 相关阅读:
    Cisco 交换机配置的基本命令
    Mysql读写分离方案-Amoeba环境部署记录
    centos7下部署zabbix3.4+grafana
    Docker
    Linux 安装源码软件
    mysql 日志
    mysql导出导入数据
    mysql 数据库的备份和还原
    Mysql 数据库管理
    英语单词
  • 原文地址:https://www.cnblogs.com/risesource/p/12051120.html
Copyright © 2011-2022 走看看