【背景】

想要在Linux下面,找之前不知道放到哪里的一个tomcat的文件。

【折腾过程】

1.最后是参考:

linux查找文件命令find – 发芽的石头 – 博客频道 – CSDN.NET

去搜:

root@bogon:openfire# find / -name '*tomcat*'
/usr/local/tomcat1
/usr/local/tomcat1/conf/tomcat-users.xml
/usr/local/tomcat1/lib/tomcat-util.jar
/usr/local/tomcat1/lib/tomcat-i18n-ja.jar
/usr/local/tomcat1/lib/tomcat-coyote.jar
/usr/local/tomcat1/lib/tomcat-i18n-fr.jar
/usr/local/tomcat1/lib/tomcat7-websocket.jar
/usr/local/tomcat1/lib/tomcat-dbcp.jar
/usr/local/tomcat1/lib/tomcat-i18n-es.jar
/usr/local/tomcat1/lib/tomcat-jdbc.jar
/usr/local/tomcat1/lib/tomcat-api.jar
/usr/local/tomcat1/webapps/manager/images/tomcat.gif
/usr/local/tomcat1/webapps/ROOT/tomcat.css
/usr/local/tomcat1/webapps/ROOT/tomcat.gif
/usr/local/tomcat1/webapps/ROOT/tomcat-power.gif
/usr/local/tomcat1/webapps/ROOT/tomcat.svg
/usr/local/tomcat1/webapps/ROOT/tomcat.png
/usr/local/tomcat1/webapps/host-manager/images/tomcat.gif
/usr/local/tomcat1/webapps/docs/images/tomcat.gif
/usr/local/tomcat1/webapps/docs/images/tomcat.svg
/usr/local/tomcat1/webapps/docs/appdev/sample/web/images/tomcat.gif
/usr/local/tomcat1/bin/tomcat-native.tar.gz
/usr/local/tomcat1/bin/tomcat-juli.jar
/usr/sbin/tomcat6
/usr/sbin/dtomcat6
/usr/bin/tomcat6-digest
/usr/bin/tomcat6-tool-wrapper
/usr/share/tomcat6
/usr/share/tomcat6/bin/tomcat-juli.jar
/usr/share/tomcat6/bin/tomcat-juli-6.0.24.jar
/usr/share/selinux/devel/include/services/tomcat.if
/usr/share/selinux/targeted/tomcat.pp.bz2
/usr/share/doc/apache-tomcat-apis-0.1
/usr/share/doc/tomcat6-6.0.24
/usr/share/java/tomcat6
/usr/share/java/tomcat6/tomcat-i18n-fr-6.0.24.jar
/usr/share/java/tomcat6/tomcat-i18n-ja.jar
/usr/share/java/tomcat6/tomcat-juli.jar
/usr/share/java/tomcat6/tomcat-coyote.jar
/usr/share/java/tomcat6/tomcat-i18n-fr.jar
/usr/share/java/tomcat6/tomcat6-jsp-2.1-api-6.0.24.jar
/usr/share/java/tomcat6/tomcat-i18n-ja-6.0.24.jar
/usr/share/java/tomcat6/tomcat6-el-2.1-api-6.0.24.jar
/usr/share/java/tomcat6/tomcat6-servlet-2.5-api-6.0.24.jar
/usr/share/java/tomcat6/tomcat-coyote-6.0.24.jar
/usr/share/java/tomcat6/tomcat-i18n-es.jar
/usr/share/java/tomcat6/extras/tomcat-juli.jar
/usr/share/java/tomcat6/extras/tomcat-juli-adapters.jar
/usr/share/java/tomcat6/tomcat-i18n-es-6.0.24.jar
/usr/share/java/apache-tomcat-apis
/usr/share/java/apache-tomcat-apis/tomcat-jsp2.1-api.jar
/usr/share/java/apache-tomcat-apis/tomcat-servlet2.5-api.jar
/usr/share/java/apache-tomcat-apis/tomcat-jsp2.0-api.jar
/usr/share/java/apache-tomcat-apis/tomcat-servlet2.4-api.jar
/usr/share/java/tomcat6-servlet-2.5-api.jar
/usr/share/java/tomcat6-jsp-2.1-api-6.0.24.jar
/usr/share/java/tomcat6-el-2.1-api-6.0.24.jar
/usr/share/java/tomcat6-servlet-2.5-api-6.0.24.jar
/usr/share/java/tomcat6-el-2.1-api.jar
/usr/share/java/tomcat6-jsp-2.1-api.jar
/var/lib/tomcat6
/var/lib/tomcat6/webapps/manager/images/tomcat.gif
/var/lib/tomcat6/webapps/sample/images/tomcat.gif
/var/lib/tomcat6/webapps/ROOT/tomcat.gif
/var/lib/tomcat6/webapps/ROOT/tomcat-power.gif
/var/lib/tomcat6/webapps/ROOT/tomcat.svg
/var/lib/tomcat6/webapps/host-manager/images/tomcat.gif
/var/lib/yum/yumdb/a/e35f1b8f8c6e2f285fc0214286e0b03beaf5e852-apache-tomcat-apis-0.1-1.el6-noarch
/var/lib/yum/yumdb/t/0c3c81b5aaba908a837902db4cba8076f2e7cc5d-tomcat6-lib-6.0.24-83.el6_6-x86_64
/var/lib/yum/yumdb/t/02426ee47b3a07f259586c51c37c8359f1c7627d-tomcat6-servlet-2.5-api-6.0.24-83.el6_6-x86_64
/var/lib/yum/yumdb/t/b60f2e9f994eb122122cf02114b51164ff7dd4c3-tomcat6-admin-webapps-6.0.24-83.el6_6-x86_64
/var/lib/yum/yumdb/t/f3acc3eab248f6f1009abdc219c1d3bea9a025ec-tomcat6-webapps-6.0.24-83.el6_6-x86_64
/var/lib/yum/yumdb/t/508295a2c951bee066ef29f46f78a02b6c50a11c-tomcat6-el-2.1-api-6.0.24-83.el6_6-x86_64
/var/lib/yum/yumdb/t/bc2836feb5319c5623fe1c243697dba038203642-tomcat6-6.0.24-83.el6_6-x86_64
/var/lib/yum/yumdb/t/9cd8fa43f523ea3019f4e806f1cb75cbd65343df-tomcat6-jsp-2.1-api-6.0.24-83.el6_6-x86_64
/var/run/tomcat6.pid
/var/log/tomcat6
/var/log/tomcat6-initd.log
/var/lock/subsys/tomcat6
/var/cache/tomcat6
/etc/tomcat6
/etc/tomcat6/tomcat-users.xml
/etc/tomcat6/tomcat6.conf
/etc/selinux/targeted/modules/active/modules/tomcat.pp
/etc/rc.d/init.d/tomcat6
/etc/rc.d/rc4.d/K20tomcat6
/etc/rc.d/rc2.d/K20tomcat6
/etc/rc.d/rc1.d/K20tomcat6
/etc/rc.d/rc6.d/K20tomcat6
/etc/rc.d/rc3.d/K20tomcat6
/etc/rc.d/rc5.d/K20tomcat6
/etc/rc.d/rc0.d/K20tomcat6
/etc/logrotate.d/tomcat6
/etc/sysconfig/tomcat6
/tmp/hsperfdata_tomcat
root@bogon:openfire#

2.后来又去试试其他的:

crifan@crifan:~$ find / -name '*dovecot.pem*'
find: ‘/sys/kernel/debug’: Permission denied
find: ‘/home/vmail’: Permission denied
/home/crifan/mail_server/dovecot/certs/dovecot.pem
/home/crifan/mail_server/dovecot/private/dovecot.pem
find: ‘/tmp/systemd-private-rCKJi3’: Permission denied
find: ‘/tmp/systemd-private-Fuif7J’: Permission denied
find: ‘/tmp/systemd-private-FhTYag’: Permission denied
find: ‘/run/httpd’: Permission denied
find: ‘/run/dovecot/token-login’: Permission denied
find: ‘/run/dovecot/login’: Permission denied
find: ‘/run/systemd/ask-password-block’: Permission denied
find: ‘/run/systemd/inaccessible’: Permission denied
find: ‘/usr/share/polkit-1/rules.d’: Permission denied
find: ‘/usr/lib/firewalld/icmptypes’: Permission denied
find: ‘/usr/lib/firewalld/services’: Permission denied
find: ‘/usr/lib/firewalld/zones’: Permission denied
find: ‘/usr/libexec/initscripts/legacy-actions/auditd’: Permission denied
find: ‘/var/cache/httpd/proxy’: Permission denied
find: ‘/var/db/sudo’: Permission denied
find: ‘/var/tmp/systemd-private-sl8Rw5’: Permission denied
find: ‘/var/tmp/systemd-private-4xjKJH’: Permission denied
find: ‘/var/tmp/systemd-private-ckkDHo’: Permission denied
find: ‘/var/spool/postfix/flush’: Permission denied
find: ‘/var/spool/postfix/corrupt’: Permission denied
find: ‘/var/spool/postfix/incoming’: Permission denied
find: ‘/var/spool/postfix/hold’: Permission denied
find: ‘/var/spool/postfix/public’: Permission denied
find: ‘/var/spool/postfix/active’: Permission denied
find: ‘/var/spool/postfix/deferred’: Permission denied
find: ‘/var/spool/postfix/bounce’: Permission denied
find: ‘/var/spool/postfix/saved’: Permission denied
find: ‘/var/spool/postfix/trace’: Permission denied
find: ‘/var/spool/postfix/defer’: Permission denied
find: ‘/var/spool/postfix/private’: Permission denied
find: ‘/var/spool/postfix/maildrop’: Permission denied
find: ‘/var/lib/authconfig/last’: Permission denied
find: ‘/var/lib/polkit-1/localauthority’: Permission denied
find: ‘/var/lib/php/session’: Permission denied
find: ‘/var/lib/mysql/crifan_wiki’: Permission denied
find: ‘/var/lib/mysql/mail’: Permission denied
find: ‘/var/lib/dovecot’: Permission denied
find: ‘/var/lib/postfix’: Permission denied
find: ‘/var/lib/tpm’: Permission denied
find: ‘/var/lib/yum/history/2014-07-07/32’: Permission denied
find: ‘/var/lib/yum/history/2014-07-07/36’: Permission denied
find: ‘/var/lib/yum/history/2014-07-07/35’: Permission denied
find: ‘/var/lib/yum/history/2014-07-07/31’: Permission denied
find: ‘/var/lib/yum/history/2014-07-07/37’: Permission denied
find: ‘/var/lib/yum/history/2014-07-07/34’: Permission denied
find: ‘/var/lib/yum/history/2014-07-07/33’: Permission denied
^C
crifan@crifan:~$ sudo find / -name '*dovecot.pem*'
[sudo] password for crifan:
/home/crifan/mail_server/dovecot/certs/dovecot.pem
/home/crifan/mail_server/dovecot/private/dovecot.pem
/etc/pki/dovecot/certs/dovecot.pem
/etc/pki/dovecot/private/dovecot.pem

如图:

其中的^C是发现很多文件没有权限,所以Ctrl+C去终止了。

然后加上sudo,就有权限去搜索了。

【总结】

想要在Linux下面查找文件,尤其是只知道部分文件名,关键字,则可以去用:

find 路径 -name ‘*要搜的关键字*’

比如:

find / -name '*tomcat*'

即可。

如果要搜的路径或文件涉及到没有权限,即出现Permission denied,则可以加上前缀sudo,比如:

sudo find / -name '*dovecot.pem*'

即可。

Linux下通过关键字模糊查找搜索文件的更多相关文章

  1. linux 下C语言编程库文件处理与Makefile编写

    做开发快3年了,在linux下编译安装软件算是家常便饭了.就拿gcc来说,都有不下10次了,可基本每次都会碰到些奇奇怪怪的问题.看来还是像vs.codeblocks这样的ide把人弄蠢了.便下定决心一 ...

  2. Linux下用rm删除的文件的恢复方法

    Linux下用rm删除的文件的恢复方法_Linux教程_Linux公社-Linux系统门户网站https://www.linuxidc.com/Linux/2008-08/14744.htm linu ...

  3. linux下查找指定后缀的文件

    1.linux下查找指定后缀的文件 例如查找当前目录下的所有后缀名时.c或.h的文件 find  .  -type f -regex  ".*\.\(c\|h\)"

  4. Linux下自动清除MySQL日志文件

    MySQL运行过程中会生成大量的日志文件,占用不少空间,修改my.cnf文件配置bin-log过期时间,在Linux下自动清除MySQL日志文件 [mysqld] expire-logs-days= ...

  5. Linux下的文件结构,及对应文件夹的作用

    Linux下的文件结构,及对应文件夹的作用 /bin 二进制可执行命令 /dev 设备特殊文件 /etc 系统管理和配置文件 /etc/rc.d 启动的配置文件和脚本 /home 用户主目录的基点,比 ...

  6. linux下添加用户并将文件夹授权给某一个用户

    ### linux下添加用户并将文件夹授权给某一个用户 背景:在做一个项目时,需要外包的前端人员调试测试环境的页面,但是又不能给他服务器的账号信息,就在服务器上新添加一个子账户,再给这个账户项目文件的 ...

  7. Linux下的命令,删除文件夹下的所有文件,而不删除文件夹本身

    Linux下的命令,删除文件夹下的所有文件,而不删除文件夹本身 rm -rf *

  8. linux 下用find命令查找文件,rm命令删除文件

    linux 下用find命令查找文件,rm命令删除文件. 删除指定目录下指定文件find 要查找的目录名 -name .svn |xargs rm -rf 删除指定名称的文件或文件夹: find -t ...

  9. [转帖]linux下使用 du查看某个文件或目录占用磁盘空间的大小

    linux下使用 du查看某个文件或目录占用磁盘空间的大小 du -ah --max-depth= 去年用过一次 后来忘记了.. 命令这个东西 熟能生巧.. https://www.cnblogs.c ...

随机推荐

  1. 启动项目时出现Not a JAR.......Find JAR........一指循环就是起不来

    出现问题原因就是mapper的映射文件有问题,里面的返回类型如是实体找不到或者找重复的就会这样 解决办法就是:确保在用的实体(路径)能找到,切记不能有重名的实体

  2. artTemplate 简洁语法版

    引用简洁语法的引擎版本,例如: <script src="dist/template.js"></script> 下载 表达式 {{ 与 }} 符号包裹起来 ...

  3. 【Python】安装geocoder

    C:\Users\horn1\Desktop\python\49-geo>pip install geocoder Collecting geocoder Downloading https:/ ...

  4. linux下安装与删除软件

    linux下安装与删除软件 (2005-07-04 11:24:10) 转载▼ 标签: 杂谈 分类: MSN搬家 现在linuxx下的软件大都是rpm,deb.tar.gz和tar.bz2格式.1.r ...

  5. AngularJs - Javascript MVC 框架

    在2012年6月google发布了AngularJs 1.0稳定版, 并宣称:AngularJS可以让你扩展HTML的语法,以便清晰.简洁地表示应用程序中的组件,并允许将标准的HTML作为你的模板语言 ...

  6. MySql 分区 分库 分表

    ubuntu下MySQL配置和管理:http://www.2cto.com/database/201306/222510.html mysql分表,分区的区别和联系:http://my.oschina ...

  7. 1066: 单词游戏(game)

    var i,j,k,n,ans,p,len,chk,zh:longint; ch:char; s:string; a:array[..] of longint; begin readln(ch); c ...

  8. Maven依赖的Scope去除部署不需要的jar 包(打包)

    <dependency> < groupId>javax.servlet</groupId> < artifactId>jsp-api</arti ...

  9. JDK5.0 特性-线程任务执行架构 ScheduledExecutorService

    来自:http://www.cnblogs.com/taven/archive/2011/12/17/2291469.html import java.util.concurrent.Callable ...

  10. Aerospike系列:1:安装

    1:下载源文件 wget http://www.aerospike.com/artifacts/aerospike-server-community/3.5.9/aerospike-server-co ...