佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > linux whatis與whatis database 使用及查詢方法(man使用實(shí)例)

linux whatis與whatis database 使用及查詢方法(man使用實(shí)例)

熱門標(biāo)簽:網(wǎng)站排名優(yōu)化 百度競價(jià)排名 服務(wù)外包 地方門戶網(wǎng)站 Linux服務(wù)器 鐵路電話系統(tǒng) 呼叫中心市場需求 AI電銷

通過man查找?guī)椭^程:

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

#覺得比較奇怪,whatis是什么呢?

[chengmo@centos5 ~]$ man whatis
#查詢得到是:
#whatis - search the whatis database for complete words.
#它是查詢whatis數(shù)據(jù)庫的工具

#The whatis database is created using the command /usr/sbin/makewhatis.
#里面還說,whatis數(shù)據(jù)庫 是通過/usr/bin/makewhatis建立的

收獲:whatis數(shù)據(jù)庫,并且有makewhatis創(chuàng)建,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 從手冊頁配置的路徑以及領(lǐng)域范圍,搜集所有手冊頁索引信息,每個(gè)手冊頁在數(shù)據(jù)庫加入一行,這行會(huì)包括手冊頁里面name,以及簡單描述。

收獲:知道這個(gè)數(shù)據(jù)庫是建立是索引,并且每個(gè)數(shù)據(jù)庫寫入一行(a line) ,會(huì)不會(huì)這個(gè)數(shù)據(jù)庫就是文本文件呢?現(xiàn)在到這里,我們不知道數(shù)據(jù)庫保存地方,也不知道它結(jié)構(gòu),只有看看whatis命令,看它是不是有源碼信息
怎么得到whatis程序源碼?

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

#告訴路徑我們看看內(nèi)容


[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).

……

#它是個(gè)sh腳本,

#得到:

#grep “關(guān)鍵詞“ /var/cache/man/whatis

#它實(shí)際在查找這個(gè)文件,/var/cache/man/whatis就是上面說的whatis 數(shù)據(jù)庫

[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數(shù)據(jù)庫就是一個(gè)文本文件記錄手冊頁的索引信息

 

whatis數(shù)據(jù)庫是什么時(shí)候創(chuàng)建的呢?

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

#發(fā)現(xiàn)創(chuàng)建時(shí)間是凌晨4點(diǎn)左右,看了這個(gè)是系統(tǒng)創(chuàng)建的,那么少不了cron懷疑了

 

[chengmo@centos5 ~]$ cat /etc/crontab  
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

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

 

有run-parts腳本運(yùn)行/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

……

找到了這個(gè)是由這個(gè)腳本運(yùn)行的

以上是通過man命令查找?guī)椭畔⒌囊粋€(gè)過程,有問題,首先分析幫助是個(gè)不錯(cuò)的選擇。

作者:chengmo QQ:8292669

標(biāo)簽:湘潭 銅川 黃山 湖南 衡水 仙桃 蘭州 崇左

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《linux whatis與whatis database 使用及查詢方法(man使用實(shí)例)》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    革吉县| 宁阳县| 寿宁县| 玛沁县| 汶上县| 吉隆县| 衡水市| 巴里| 湄潭县| 乌兰县| 儋州市| 泌阳县| 张家口市| 大渡口区| 清苑县| 安阳县| 巴林左旗| 建瓯市| 麟游县| 林口县| 洛宁县| 大埔区| 花莲县| 赤城县| 德化县| 红安县| 苍溪县| 水富县| 南漳县| 磐安县| 同江市| 康保县| 温宿县| 万宁市| 岳阳市| 鲁山县| 河西区| 华容县| 乌海市| 内黄县| 灵宝市|