這篇文章主要講解了“如何使用linux whatis與whatis database”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“如何使用linux whatis與whatis database”吧!
通過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 從手冊頁配置的路徑以及領域范圍,搜集所有手冊頁索引信息,每個手冊頁在數(shù)據(jù)庫加入一行,這行會包括手冊頁里面name,以及簡單描述。
收獲:知道這個數(shù)據(jù)庫是建立是索引,并且每個數(shù)據(jù)庫寫入一行(a line) ,會不會這個數(shù)據(jù)庫就是文本文件呢?現(xiàn)在到這里,我們不知道數(shù)據(jù)庫保存地方,也不知道它結構,只有看看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).
……
#它是個sh腳本,
#得到:
#grep “關鍵詞“ /var/cache/man/whatis
#它實際在查找這個文件,/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ù)庫就是一個文本文件記錄手冊頁的索引信息
whatis數(shù)據(jù)庫是什么時候創(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)建時間是凌晨4點左右,看了這個是系統(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腳本運行/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命令查找?guī)椭畔⒌囊粋€過程,有問題,首先分析幫助是個不錯的選擇。
感謝各位的閱讀,以上就是“如何使用linux whatis與whatis database”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對如何使用linux whatis與whatis database這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián)網(wǎng)站建設公司,,小編將為大家推送更多相關知識點的文章,歡迎關注!
網(wǎng)頁標題:如何使用linuxwhatis與whatisdatabase-創(chuàng)新互聯(lián)
URL地址:http://chinadenli.net/article16/cdgpgg.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、網(wǎng)站排名、App設計、網(wǎng)站營銷、關鍵詞優(yōu)化、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容