位置: 编程技术 - 正文

linux whatis与whatis database 使用及查询方法(man使用实例)

编辑:rootadmin

推荐整理分享linux whatis与whatis database 使用及查询方法(man使用实例),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

通过man查找帮助过程:

[chengmo@centos5 ~]$ man -h... f:same as whatis(1)...

#觉得比较奇怪,whatis是什么呢?

[chengmo@centos5 ~]$ man whatis#查询得到是:#whatis - search the whatis database for complete words. #它是查询whatis数据库的工具

#The whatis database is created using the command /usr/sbin/makewhatis.#里面还说,whatis数据库 是通过/usr/bin/makewhatis建立的

收获:whatis数据库,并且有makewhatis创建,whatis脚本是用作查询的

makewhatis是怎么样工作的呢?

[chengmo@centos5 ~]$ man makewhatis

#得到:

makewhatis reads all the manual pages contained in the given sections of manpath or the preformatted pages con-tained in the given sections of catpath. For each page, it writes a line in the whatis database; each line consists of the name of the page and a short description, separated by a dash. The description is extracted using the content of the NAME section of the manual page.

#大概意思是:makewhatis 从手册页配置的路径以及领域范围,搜集所有手册页索引信息,每个手册页在数据库加入一行,这行会包括手册页里面name,以及简单描述。

收获:知道这个数据库是建立是索引,并且每个数据库写入一行(a line) ,会不会这个数据库就是文本文件呢?现在到这里,我们不知道数据库保存地方,也不知道它结构,只有看看whatis命令,看它是不是有源码信息怎么得到whatis程序源码&#;

[chengmo@centos5 ~]$ type whatiswhatis is /usr/bin/whatis

#告诉路径我们看看内容

[chengmo@centos5 ~]$ vi /usr/bin/whatis

1 #!/bin/sh 2 # 3 # apropos -- search the whatis database for keywords. 4 # whatis -- idem, but match only commands (as whole words).

……

#它是个sh脚本,

#得到:

linux whatis与whatis database 使用及查询方法(man使用实例)

#grep “关键词“ /var/cache/man/whatis

#它实际在查找这个文件,/var/cache/man/whatis就是上面说的whatis 数据库

[chengmo@centos5 ~]$ head /var/cache/man/whatis $notes_name [Module::Build::Notes] (3pm) - Configuration for $module_name*_unlocked [unlocked_stdio] (3) - non-locking stdio functions

#whatis数据库就是一个文本文件记录手册页的索引信息

whatis数据库是什么时候创建的呢?

[chengmo@centos5 ~]$ ls -al /var/cache/man/whatis -rw-r--r-- 1 root root - : /var/cache/man/whatis

#发现创建时间是凌晨4点左右,看了这个是系统创建的,那么少不了cron怀疑了

[chengmo@centos5 ~]$ cat /etc/crontab SHELL=/bin/bashPATH=/sbin:/bin:/usr/sbin:/usr/binMAILTO=rootHOME=/

# run-parts * * * * root run-parts /etc/cron.hourly 4 * * * root run-parts /etc/cron.daily 4 * * 0 root run-parts /etc/cron.weekly 4 1 * * root run-parts /etc/cron.monthly

有run-parts脚本运行/etc/cron.daily目录下面的文件

[chengmo@centos5 ~]$ cd /etc/cron.daily/

[chengmo@centos5 cron.daily]$ cat makewhatis.cron #!/bin/bash

LOCKFILE=/var/lock/makewhatis.lock

makewhatis -u -w

……

找到了这个是由这个脚本运行的

以上是通过man命令查找帮助信息的一个过程,有问题,首先分析帮助是个不错的选择。

作者:chengmo QQ:

linux dev 常见特殊设备介绍与应用(loop,null,zero,full,random) linux是文件型系统,所有硬件如软件都会在对于的目录下面有相应的文件表示。对于dev这个目录,我们知道它下面的文件,表示的是linux的设备。在windows

linux shell命令快捷获得系统帮助(一)[man-pages定义规范] 作为刚刚学习linux朋友,我们拿到一个命令,不知道怎么样使用,一般都会先看下命令默认参数说明,然后再不清楚就是通过man命令查阅手册。还是找不

linux shell实现随机数几种方法分享(date,random,uuid) 在日常生活中,随机数实际上经常遇到,想丢骰子,抓阄,还有抽签。呵呵,非常简单就可以实现。那么在做程序设计,真的要通过自己程序设计出随

本文链接地址:https://www.jiuchutong.com/biancheng/371371.html 转载请保留说明!

上一篇:linux shell 字符串操作(长度,查找,替换)详解(linux shell 字符串转数字)

下一篇:linux dev 常见特殊设备介绍与应用(loop,null,zero,full,random)(linux dev/sr0)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络