LinuxShell-查找命令/文件

【版权申明】未经博主同意,谢绝转载!(请尊重原创,博主保留追究权) 

LinuxShell目录传送门: https://blog.csdn.net/MACMACip/article/details/89890219

LinuxShell-查找命令/文件

  1.which
  2.whereis
  3.find

1.which

$ man which
  locate a command
  定位一个命令

  言简意赅, 它就是告诉你, 这个命令的可执行文件放在哪.如:
which mv告诉你, mv这条命令/这个程序, 被放在/bin/mv中.(为什么是在这个路径下呢? 在这里我假设你已经知道了Linux的环境变量Path).

2.whereis

$ man whereis
  locate the binary, source, and manual page files for a command
  定位一个二进制文件(即可执行文件), 以及它的源代码和man手册(帮助文档).

   和which命令相对比, 很显然whereis命令比他强大得多, 因为它不仅告诉你这条命令放在哪, 而且还告诉你与这条命令相关联的代码以及帮助文档放在哪. 如下图:
whereis mv

3.find

$ man find
  search for files in a directory hierarchy
  从一个目录里, 递归地往下查找一个文件.

这是一个很常用到的命令, 帮助你找到一个文件, 速度很快! (比图形界面快多了)
常用的命令格式为: find [搜索目录, 为空则是当前目录] -name [filename] -user [username]
  在实际的工作中, 你可能只记得一个文件名的头几个字母或者中间几个字母或仅仅是后缀名, 这时候, 你需要认识我们LinuxShell中的通配符:

?*[][!]
通配符讲解:匹配任一个字符匹配任何字符(0或多个)匹配符号内任一字符, 至少要有一个匹配不匹配[]里面任一字符, 至少要有一个
举例: abc.txta?c.txt*.txt[a]bc.txt[!x]bc.txt

   举例中所有字串, 配合find命令皆可以找到这个abc.txt(如果你不钻牛角尖的话~).

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Log data follows: | DEBUG: Executing shell function do_configure | CMake Warning at CMakeLists.txt:7 (message): | Build type not set, falling back to Release mode. | | To specify build type use: | -DCMAKE_BUILD_TYPE=<mode> where <mode> is Debug or Release. | | | -- Building without demo. To enable demo build use: -DWITH_DEMO=True | -- The C compiler identification is GNU 7.3.0 | -- The CXX compiler identification is GNU 7.3.0 | -- Check for working C compiler: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/aarch64-niic-linux/aarch64-niic-linux-gcc | -- Check for working C compiler: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/aarch64-niic-linux/aarch64-niic-linux-gcc -- works | -- Detecting C compiler ABI info | -- Detecting C compiler ABI info - done | -- Detecting C compile features | -- Detecting C compile features - done | -- Check for working CXX compiler: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/aarch64-niic-linux/aarch64-niic-linux-g++ | -- Check for working CXX compiler: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/aarch64-niic-linux/aarch64-niic-linux-g++ -- works | -- Detecting CXX compiler ABI info | -- Detecting CXX compiler ABI info - done | -- Detecting CXX compile features | -- Detecting CXX compile features - done | -- Found PkgConfig: /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/recipe-sysroot-native/usr/bin/pkg-config (found version "0.29.2") | -- Checking for module 'uuid' | -- Found uuid, version 2.32.1 | -- Output libraries to /home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/git/runtime/Cpp/dist | CMake Error at runtime/CMakeLists.txt:104 (install): | install TARGETS given no LIBRARY DESTINATION for shared library target | "antlr4_shared". | | | CMake Error at runtime/CMakeLists.txt:107 (install): | install TARGETS given no ARCHIVE DESTINATION for static library target | "antlr4_static". | | | -- Configuring incomplete, errors occurred! | See also "/home/wu/test_D9/D9_PTG1.5/build-d9/tmp/work/aarch64-niic-linux/antlr4/4.7.2-r0/build/CMakeFiles/CMakeOutput.log".这是报错的log,如何解决这个问题
07-11

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

安河桥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值