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
    
  • 相关阅读:
    H5本地存储
    小知识(h5 js )
    在ubuntu18.04版本安装vscode
    函数基本操作
    python直接赋值、深浅拷贝实例剖析
    collections模块简介
    set()集合基本操作
    list、tuple、dict内部功能释义
    str内部方法释义
    int内部方法释义
  • 原文地址:https://www.cnblogs.com/risesource/p/12051120.html
Copyright © 2011-2022 走看看