简体   繁体   English

如何在 Linux 上的指定目录中查找使用特定标头的所有文件?

[英]How to find all the files that use a particular header in a specified directory on Linux?

I have huge directory with makefiles, .c, .h .cpp etc. The final output (binary) is built using make.我有一个很大的目录,里面有 makefile、.c、.h 和 .cpp 等。最终的输出(二进制)是使用 make 构建的。

To do that I have to find and investigate the source files that use <aio.h> and <execinfo.h> headers.为此,我必须查找并调查使用<aio.h><execinfo.h>标头的源文件。 So how do I find the files that use #include <aio.h> and #include <execinfo.h>那么如何找到使用#include <aio.h>#include <execinfo.h>

For browsing big code, cscope or ctags is used.浏览大代码时,使用 cscope 或 ctags。 Both needs to generate database.两者都需要生成数据库。 For cscope it can be done by command cscope -bq -k and later cscope-d will give console menu for search options.对于 cscope,它可以通过命令 cscope -bq -k 完成,稍后 cscope-d 将提供用于搜索选项的控制台菜单。 Find or grep will be slow for browsing of big code. Find 或 grep 浏览大代码会很慢。

find . -name '*.c (or*.h)' -exec grep "thing_to_Search_for" '{}' \; -print

这个命令帮助我实现了我需要的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在linux中查找具有特定父目录的所有文件? - How to find all files with a particular parent directory in linux? 删除linux中目录的所有子目录中的特定文件 - Delete particular files in all subdirectories of a directory in linux 如何使用在 linux 到 output 中查找当前目录中在一行中匹配多个条件的所有文件 - How to use find in linux to output all files in current directory which match multiple criteria in a single line 在指定目录中查找所有依赖于指定库的可执行文件 - Find all executable files that depend on the specified library in the specified directory 在python中查找所有linux文件的通用目录 - Find general directory of all linux files in python 关于在Linux中特定目录的所有文件中搜索关键字 - Regarding searching a keyword in all files in particular directory in linux 如何在 Linux C 程序中显示用户指定名称为“ls dir_name”的目录中的所有文件 - How to display all files in directory of which name is specified by the user as “ls dir_name” in Linux C program 如何删除一个特定目录中的所有文件 - How to delete all files in one particular directory 如何在Linux中使用grep查找包含特定命令的所有文件? - How to use grep in linux to find all files contain a specific command? 如何在Linux中查找没有目录路径的文件 - How to find files without a directory path in Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM