在UNIX中搜索文件 [英] Search file in UNIX

查看:101
本文介绍了在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


这篇关于在UNIX中搜索文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆