查找文件或目录

find命令示例:

  • find . -name 'Do*' 搜索当前目录(含子目录)中文件名以Do开头的文件;
  • find . -name 'Do*' -ls 搜索当前目录(含子目录)中文件名以Do开头的文件,并显示详细信息;
  • find . -type f -mmin -10 搜索当前目录(含子目录)中过去10分钟更新过的普通文件;如果不加-type f参数,则搜索普通文件、特殊文件和目录;

locate命令示例:

  • locate *.log 搜索locate命令已知的所有log结尾的文件;
  • locate ~/Do 搜索当前用户目录中以Do开头的目录及文件;
  • locate -i ~/Do 忽略大小写,搜索当前用户目录中以Do开头的目录及文件;

注意:locate命令并不能实时反映情况。

  • locate命令其实是通过搜索本地所有文件信息的缓存(/var/lib/locatedb)来反馈结果。
  • 这个缓存在系统启动时被创建,并且每天自动更新一次,所以使用locate命令无法查到最新的变动。
  • 建议在使用locate之前,先使用updatedb命令手动更新数据库。

查找文本

注意:在搜索指定开头的行和单词的使用区别。

[root@CentOS-7 ~]# ls -l
total 4
-rw-------. 1 root root 2018 Aug 30 2016 anaconda-ks.cfg
drwxr-xr-x. 2 root root 6 Mar 1 2017 Desktop
drwxr-xr-x. 2 root root 6 Mar 1 2017 Documents
drwxr-xr-x. 2 root root 6 Mar 1 2017 Downloads
drwxr-xr-x. 2 root root 6 Mar 1 2017 Music
drwxr-xr-x. 2 root root 6 Mar 1 2017 Pictures
drwxr-xr-x. 2 root root 6 Mar 1 2017 Public
drwxr-xr-x. 2 root root 6 Mar 1 2017 Templates
drwxr-xr-x. 2 root root 6 Mar 1 2017 Videos
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# ls -l |grep M*
drwxr-xr-x. 2 root root 6 Mar 1 2017 Music
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# ls -l |grep ^M
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# ls -l |grep ^-rw
-rw-------. 1 root root 2018 Aug 30 2016 anaconda-ks.cfg
[root@CentOS-7 ~]#
[root@CentOS-7 ~]#

查找命令

获取命令帮助信息

  • which 显示命令的路径;
  • whereis 显示命令的路径、手册等信息(locate the binary, source, and manual page files for a command);
  • whatis 显示命令手册的页眉行,等同于man -f命令,可确认有哪些章节存在;
  • type 判断是否是内置命令,如果是外部命令将给出简要信息;

使用示例:

[root@CentOS-7 ~]# which find
/usr/bin/find
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# whereis find
find: /usr/bin/find /usr/share/man/man1/find.1.gz /usr/share/man/man1p/find.1p.gz
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# whatis find
find (1) - search for files in a directory hierarchy
find (1p) - find files
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# type find
find is hashed (/usr/bin/find)
[root@CentOS-7 ~]#
[root@CentOS-7 ~]# type cd
cd is a shell builtin
[root@CentOS-7 ~]#

查找文档

  • /usr/share/doc/目录:程序相关文档
  • /usr/share/man目录:man命令的帮助文件

Manual Page Chapter List

1:所有用户可以操作的指令或可执行文件
2:系统核心调用的函数与工具
3:子调用,常用的函数与函数库
4:设备,硬件文件说明,通常是/dev/的文件
5:文件格式,配置文件或者是某些档案的格式
6:游戏相关
7:杂项,例如linux文件系统、网络协议、ASCIIcode等说明
8:系统管理员可用的命令
9:跟kernel有关的文件

Linux - 在当前系统内查找信息的方法的更多相关文章

  1. linux vsftp查看ftp账号信息的方法

    linux vsftp查看ftp账号信息的方法 查看注册的FTP账号 在/etc/vsftpd/chroot_list 密码看不到 只能重置密码 passwd username

  2. Linux下查看系统版本号信息的方法

    一.查看Linux内核版本命令(两种方法): 1.cat /proc/version 2.uname -a 二.查看Linux系统版本的命令(3种方法): 1.lsb_release -a,即可列出所 ...

  3. Linux下查看Raid磁盘阵列信息的方法

    Linux下查看软.硬raid信息的方法. 软件raid:只能通过Linux系统本身来查看 cat /proc/mdstat 可以看到raid级别,状态等信息. 硬件raid: 最佳的办法是通过已安装 ...

  4. Linux下查看系统版本号信息的方法(转)

    一.查看Linux内核版本命令: 1.cat /proc/version [root@localhost ~]# cat /proc/versionLinux version 2.6.18-194.8 ...

  5. linux服务器查看公网IP信息的方法

    最近在解决网络问题时,需要查看本机的出口公网IP信息,所以在网络上搜索和请求运维达人,获得如下两个方法: curl ifconfig.me 在linux系统中输入上述的命令,可以查看到本机连接的公网信 ...

  6. Linux下查看系统版本号信息的方法(转载)

    原文出处  http://www.ha97.com/2987.html 1.cat /proc/version [root@localhost ~]# cat /proc/versionLinux v ...

  7. uboot向linux传递输出任何log信息的方法

    答案:在bootargs中加入loglevel=8即可(在进入linux的过程中会输出任何log信息)

  8. Linux -- 在文件中添加信息的方法(转)

    转自:https://www.cnblogs.com/ZGreMount/p/7645542.html 创建test 文件: touch test.txt 方法一:echo 命令法: echo &qu ...

  9. Linux系统中如何查找大文件或文件夹的方法

    在Windows系统中,我们可以使用TreeSize工具查找一些大文件或文件夹,非常的方便高效,在Linux系统中,如何去搜索一些比较大的文件呢?下面我整理了一下在Linux系统中如何查找大文件或文件 ...

随机推荐

  1. ceph常用运维技巧总结1

    格式 json 数据增强可读性 --format json-pretty -f json-pretty ceph quorum_status -f json-pretty ceph mon_statu ...

  2. 关于spfa

    关于spfa的一些事宜.... 刚开始学的时候只会跑最短路,代码都是背下来的.以下是背的代码... inline void spfa(int s) { queue<int>q;q.push ...

  3. 关于Shader的学习记录

    float4 _EmissiveColor; float4 _AmbientColor; float _MySliderValue; void surf (Input IN, inout Surfac ...

  4. 【Python深入】Python中继承object和不继承object的区别

    python中定义class的时候,有object和没有object的不同?例如: class Solution(object): class Solution(): 这俩的区别在于—————— 在p ...

  5. java_18 Collection接口

    1.Collection接口 Collection 层次结构 中的根接口.Collection 表示一组对象,这些对象也称为 collection 的元素.一些 collection 允许有重复的元素 ...

  6. vba统计电脑计算机名和登陆的用户名

    Public Sub GetIPT() gipt = Trim(InputBox("请输入所在组,只需输入前面的字母代码即可 A- groupA B-groupB C-groupC D-gr ...

  7. dfs | Security Badges

    Description You are in charge of the security for a large building, with n rooms and m doors between ...

  8. PHP开发——超全局数组变量

    概述 l  JS中的变量分两类:局部变量.全局变量. l  PHP中的变量分三类:局部变量.全局变量.超全局变量. l  局部变量:在函数内部声明的变量,就是局部变量.函数执行完毕,局部变量就消失了. ...

  9. Annotation 标注

    1.画出基本图 当图线中某些特殊地方需要标注时,我们可以使用 annotation. matplotlib 中的 annotation 有两种方法, 一种是用 plt 里面的 annotate,一种是 ...

  10. Codeforces Round #436 (Div. 2)C. Bus 模拟

    C. Bus time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input out ...