在UNIX中搜索文件

在UNIX中搜索文件

问题描述:

你好,

我的文件位于Unix环境中.
我在UNIX的主目录中,现在我要搜索文件.

如何从主目录在UNIX目录/子目录中搜索文件(xyz.h)?

在此先感谢您.

Hello,

My file is located in unix env.
I am in the home dir of unix and now i want to search my file.

How to search a file (xyz.h)in UNIX dir / sub dirs from home dir?

Thanks in advance.

locate将在您创建文件后系统更新其数据库的情况下(迅速)运行.

find将始终有效,因为它会搜索文件系统:

locate will work (and quickly) if your system has updated its database since you created the file.

find will always work because it searches the filesystem:

find / -name xyz.h -ls



ack [ ^ ]是一个非常方便的实用程序,用于搜索文件中的字符串.



And ack[^] is a very handy utility for searching for strings in files.


我猜
find / | grep xyz.h


会做的.
:)


will do the job.
:)


您也可以使用 locate [^ ]而不是find
You can also use locate[^] instead of find
locate xyz.h