Linux查找文件
which 可以查找可执行文件的位置
evilxr@IdeaPad:~$ which ping
/bin/ping
whereis
whereis -m 可查询到命令的帮助文档在什么地方
evilxr@IdeaPad:~$ whereis -m ls
ls: /usr/share/man/man1/ls.1.gz
evilxr@IdeaPad:~$ whereis -m pwd
pwd: /usr/share/man/man1/pwd.1.gz
evilxr@IdeaPad:~$ whereis pwd
pwd: /bin/pwd /usr/include/pwd.h /usr/share/man/man1/pwd.1.gz
输出信息有三条
1.命令本身所在目录
2.其源文件所在目录
3.其帮助文档所在目录
locate 基于本地计算机数据库(计算机磁盘信息),速度比find快些。locate一般是在晚上更新数据库,但是也可以自己手动更新
root@IdeaPad:~# sudo updatedb
root@IdeaPad:~/test# ls
1.txt 2.txt aa.tar.gz ab.tar.bz2 ac.tar ac.tar.bz2 ac.tar.gz
root@IdeaPad:~/test# locate aa.tar.gz
/root/test/aa.tar.gz
root@IdeaPad:~/test# cd /tmp
root@IdeaPad:/tmp# locate aa.tar.gz
/root/test/aa.tar.gz
root@IdeaPad:/tmp#
创建一个新文件,用locate试试~
root@IdeaPad:~/test# touch aobama
root@IdeaPad:~/test# ed aobama
0
a
我是新创建的文件,
看下locate命令能找到我么~
.
w
63
q
root@IdeaPad:~/test# locate aobama
root@IdeaPad:~/test#
结果找不到~
更新数据库后看下:
@IdeaPad:~/test# sudo updatedb
root@IdeaPad:~/test# locate aobama
/root/test/aobama
root@IdeaPad:~/test#
find 命令 全盘扫描,类似windows的查找;速度比较慢
find可以基于文件名查找
root@IdeaPad:~# find ./ -name 'te*'
./test
root@IdeaPad:~# find ./ -name '1*'
./test/1.txt
./1.txt
root@IdeaPad:~#
Linux查找文件的更多相关文章
- [转] Linux 查找文件内容
Linux查找文件内容的常用命令方法. 从文件内容查找匹配指定字符串的行: $ grep "被查找的字符串" 文件名例子:在当前目录里第一级文件夹中寻找包含指定字符串的.in文件g ...
- [转帖]Linux查找文件6个高效工具
Linux查找文件6个高效工具 https://www.linuxrumen.com/rmxx/176.html 需要实操 -inname -type 等等. 1. 前言 我们使用Linux过程中,经 ...
- Linux 查找文件
find 查找目录 -name "文件名"find / -name "php.ini"locate 文件名locate php.ini 一:locate命令 l ...
- Linux 查找文件内容、替换
有的时候我们经常性的需要在 linux 某一个目录下查找那些文件里包含我们需要查找的字符,那么这个时候就可以使用一些命令来查找,比如说 grep 1.grep 查询 1.1. 主要参数 [option ...
- Linux 查找文件命令 find whereis locate
Linux 有三个查找文件的命令:find, whereis, locate 其中find 不常用,whereis与locate经常使用,因为find命令速度较慢,因为whereis与locate是利 ...
- Linux查找文件夹下包含某字符的所有文件
Linux grep 命令用于查找文件里符合条件的字符串.grep 指令用于查找内容包含指定的范本样式的文件,如果发现某文件的内容符合所指定的范本样式,预设 grep 指令会把含有范本样式的那一列显示 ...
- Linux查找文件内容小技巧
目录 grep ag linux系统查找文件内容最常见的命令有grep和ag grep grep是比较常见的查找命令 # 在当前目录的py文件里查找所有相关内容 grep -a "broad ...
- Linux 查找文件的正确方式
Linux 系统中查找文件的命令有 which.whereis.locate 和 find 等,本文对这四条命令进行简单的介绍.列举了一些简单的使用方式. which 在 PATH 变量中定义的全部路 ...
- Linux查找文件、文件夹
https://www.jianshu.com/p/f3a46e5c96ba 查找目录:find /(查找范围) -name '查找关键字' -type d 查找文件:find /(查找范围) -na ...
- linux查找文件夹命令
查找命令: 查找根目录下查找文件夹名称叫www.91cnm.com的目录地址 find / -name www.91cnm.com -d 1 查找/var/www/目录下叫index.php的文件 f ...
随机推荐
- Program L 暴力求解
Description The GeoSurvComp geologic survey company is responsible for detecting underground oil dep ...
- ctime、atime
Linux系统文件有三个主要的时间属性,分别是ctime(change time, 而不是create time), atime(access time), mtime(modify time).后来 ...
- java基础之 垃圾回收机制
1. 垃圾回收的意义 在C++中,对象所占的内存在程序结束运行之前一直被占用,在明确释放之前不能分配给其它对象:而在Java中,当没有对象引用指向原先分配给某个对象的内存时,该内存便成为垃圾.JVM的 ...
- Helloworld程序的创建以及配置文件的讲解
创建项目. create Project 选择创建的Project类别以及使用的SDK,可能SDK需要配置或者修改配置. 这个页面是问你是否使用模板创建. Command Line App 会自动创建 ...
- C# HttpBrowser 跨进程访问,解决内存泄露问题
#undef DEBUG using Microsoft.Win32; using Newtonsoft.Json; using System; using System.Collections.Ge ...
- php 未配置curl
用到PHP的curl功能,发现服务器上的PHP并没有配置curl,进而查询PHP官方文档,得知编译PHP时需要带上 –with-curl参数,才能把curl模块编译进去.我现在PHP已经编译安装进服务 ...
- 《JAVA学习笔记 (final关键字)》
[14-9]面向对象-final关键字 /* 继承的弊端,打破封装性. 不让其他类继承该类,就不会有重写. 怎么能实现呢?通过Java中的一个关键子来实现,final(最终化). [final关键字] ...
- 理解NSTypesetter 和 NSATSTypesetter
先说通常意义上的typeset(排字.排版),然后再说NSTypesetter 和 NSATSTypesetter,最后是它们的区别. Typesetting is the composition o ...
- druid简介
Druid首先是一个数据库连接池,但它不仅仅是一个数据库连接池,它还包含一个ProxyDriver,一系列内置的JDBC组件库,一个SQL Parser. 支持的数据库 Druid支持所有JDBC兼容 ...
- IIS6的session丢失问题
解决办法: a IIS6中相比IIS5增加了一个应用程序池,默认是使用DefaultAppPool. b 先为站点建立一个应用程序池,打开IIS管理器,右键点击应用程序池-新建 ...