2009-06-28 17:51:46 +0000 2009-06-28 17:51:46 +0000
467
467
Advertisement

如何在linux上找到一个目录?

Advertisement

我有一个VPS,用的是Suse Linux 10.3

我通过SSH/putty登录,想找到我的网页文件的位置。

我的google搜索教我这样做,进入我的根目录,输入:

find httpdocs -type d

,但它显示 “没有这个文件或目录"。

Advertisement

答案 (4)

636
636
636
2009-06-28 18:00:16 +0000

它是:

find / -type d -name 'httpdocs'

第一个参数"/“是查找的地方,这里的”/“是整个系统。

63
63
63
2009-06-28 18:00:01 +0000

这个命令应该可以让你找到你要找的东西:

find / -type d -name httpdocs

,它可以从服务器的根目录中搜索带有httpdocs名称的目录,或者如果你只想从当前目录中搜索,将’/‘替换为’.

28
Advertisement
28
28
2013-11-08 01:04:05 +0000
find / -type d -name httpdocs 2> /dev/null

这将消除所有的错误信息,当你不以root用户的身份做这个操作时,你可能会(读到的,总是)得到所有的错误信息。建议用这种方式来做。

13
13
13
2015-12-06 23:50:21 +0000

知道参数-iname对搜索 “大小写不区分 "的模式和通配符的使用很重要。*两个例子:

从/root中搜索所有包含 "Linux "字符串的文件,不区分大小写:

find /root -type f -iname "*linux*"

从/root中搜索所有包含 "Linux "字符串的目录,不区分大小写: find /root -type d -iname "*linux*"

从这里摘录: http://www.sysadmit.com/2015/12/linux-buscar-ficheros-directorios-con-find.html

Advertisement