从命令行在目录中查找文件 [英] Find file in directory from command line

查看:90
本文介绍了从命令行在目录中查找文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在eclipse和textmate等编辑器/编辑器中,有一些快捷方式可以在项目目录中快速找到特定文件.

In editors/ides such as eclipse and textmate, there are shortcuts to quickly find a particular file in a project directory.

在bash或其他shell中,是否有类似的工具可以对目录中的文件名(递归)执行完整路径?

Is there a similar tool to do full path completion on filenames within a directory (recursively), in bash or other shell?

我有很多目录的项目,在那个目录有很深的目录(叹气,java). Shell中的命中"选项卡只能循环访问直接目录中的文件,那还不够=/

I have projects with alot of directories, and deep ones at that (sigh, java). Hitting tab in the shell only cycles thru files in the immediate directory, thats not enough =/

推荐答案

find /root/directory/to/search -name 'filename.*'
# Directory is optional (defaults to cwd)

支持标准UNIX globbing.有关更多信息,请参见 man find .

Standard UNIX globbing is supported. See man find for more information.

如果您使用的是Vim,则可以使用:

If you're using Vim, you can use:

:e **/filename.cpp

:tabn或任何接受文件名的Vim命令.

Or :tabn or any Vim command which accepts a filename.

这篇关于从命令行在目录中查找文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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