在 Linux (Red Hat, Fedora, Ubuntu) 等 Unix/Like 的平台都會使用 locate 去找檔案 ,然而, 所有的檔案路徑名稱資訊, 都是記錄在 locate database 裡, 通常, 會使用 updatedb 指令在終端機下 ,進行 locate database 的更新, 但是, 換到 FreeBSD 時, 輸入 updatedb 時, 卻是 command not found ? 該如何解決 ?

方法很簡單, 改用  /usr/libexec/locate.updatedb 即可, 以下為執行的結果.  (當然, 你必須使用 root 帳號身份進行)

It's so easy, try use /usr/libexec/locate.updatedb command.

# /usr/libexec/locate.updatedb
>>> WARNING
>>> Executing updatedb as root.  This WILL reveal all filenames
>>> on your machine to all login users, which is a security risk.
#

更新前 (Before)

# ls -l /var/db/locate.database
-rw-r--r--  1 nobody  wheel  0 Jul 19 10:25 /var/db/locate.database

更新後(After)

# ls -l /var/db/locate.database
-rw-r--r--  1 nobody  wheel  1935489 Oct  5 10:02 /var/db/locate.database

以上供參考 ,謝謝


arrow
arrow
    全站熱搜

    Frank 發表在 痞客邦 留言(0) 人氣()