麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 開發 > Linux Shell > 正文

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

2020-07-27 19:04:34
字體:
來源:轉載
供稿:網友

通過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 whatis
whatis 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腳本,

#得到:

#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 1057156 10-27 04:06 /var/cache/man/whatis

#發現創建時間是凌晨4點左右,看了這個是系統創建的,那么少不了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命令查找幫助信息的一個過程,有問題,首先分析幫助是個不錯的選擇。

作者:chengmo QQ:8292669

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 国产视频在线观看免费 | 欧美一级免费在线观看 | 91av国产在线 | 2019天天干夜夜操 | 久久艹国产精品 | 免费毛片小视频 | 日韩av手机在线免费观看 | 久久国产精品电影 | 日本网站在线看 | 亚洲人成网站免费播放 | 久久久久久久久久久国产精品 | 嫩草影院在线观看网站成人 | 午夜国产成人 | 久久精品资源 | 2018亚洲男人天堂 | 护士xxxx| 国产精品高潮视频 | 久久福利小视频 | 杏美月av | 国产日本在线播放 | 极品xxxx欧美一区二区 | 日韩毛片在线看 | 长泽雅美av | 黄色网欧美 | 成人免费一区二区三区视频网站 | 激情小说激情图片激情电影 | 羞羞草视频 | 国产亚洲精品久久久久久网站 | 91羞羞 | 欧美精品免费一区二区三区 | 性盈盈盈影院 | 久久免费视频7 | 一级大黄毛片免费观看 | 天天草天天干天天射 | 黄污在线看 | 国产流白浆高潮在线观看 | 青青青在线免费 | 69性欧美高清影院 | 成人午夜在线免费观看 | 久久最新视频 | 成年免费观看视频 |