{"id":2093,"date":"2019-05-24T23:44:58","date_gmt":"2019-05-24T15:44:58","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=2093"},"modified":"2019-05-26T11:51:26","modified_gmt":"2019-05-26T03:51:26","slug":"updatedb","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/updatedb","title":{"rendered":"updatedb\u547d\u4ee4 – \u521b\u5efa\u6216\u66f4\u65b0\u6570\u636e\u5e93\u6587\u4ef6"},"content":{"rendered":"\n
updatedb\u547d\u4ee4\u7528\u6765\u521b\u5efa\u6216\u66f4\u65b0 slocate\/locate \u547d\u4ee4\u6240\u5fc5\u9700\u7684\u6570\u636e\u5e93\u6587\u4ef6\u3002<\/p>\n\n\n\n
updatedb\u547d\u4ee4\u7684\u6267\u884c\u8fc7\u7a0b\u8f83\u957f\uff0c\u56e0\u4e3a\u5728\u6267\u884c\u65f6\u5b83\u4f1a\u904d\u5386\u6574\u4e2a\u7cfb\u7edf\u7684\u76ee\u5f55\u6811\uff0c\u5e76\u5c06\u6240\u6709\u7684\u6587\u4ef6\u4fe1\u606f\u5199\u5165 slocate\/locate \u6570\u636e\u5e93\u6587\u4ef6\u4e2d\u3002 \u6ce8\u610f\uff1aslocate \u672c\u8eab\u5177\u6709\u4e00\u4e2a\u6570\u636e\u5e93\uff0c\u91cc\u9762\u5b58\u653e\u4e86\u7cfb\u7edf\u4e2d\u6587\u4ef6\u4e0e\u76ee\u5f55\u7684\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n\n\n\n
\u4f7f\u7528updatedb\u547d\u4ee4\u53ef\u4ee5\u521b\u5efa\u6216\u66f4\u65b0locate\u6240\u4f7f\u7528\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u6570\u636e\u5e93\u5df2\u7ecf\u5b58\u5728\uff0c\u5b83\u7684\u6570\u636e\u662f\u91cd\u590d\u4f7f\u7528\uff0c\u4ee5\u907f\u514d\u91cd\u8bfb\u5e76\u6ca1\u6709\u6539\u53d8\u7684\u76ee\u5f55\u3002updatedb\u901a\u5e38\u6bcf\u5929\u7531cron\u8fd0\u884c\u6765\u66f4\u65b0\u9ed8\u8ba4\u7684\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>updatedb [\u53c2\u6570] <\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u68c0\u6d4b\u4e00\u4e2a\u672a\u5b58\u5728\u7684\u6587\u4ef6file.txt\uff1a<\/p>\n\n\n\n \u4f7f\u7528 -U \u53c2\u6570\u53ef\u4ee5\u6307\u5b9a\u8981\u66f4\u65b0 slocate \u6570\u636e\u5e93\u7684\u76ee\u5f55\uff1a<\/p>\n\n\n\n \u521b\u5efa\u6216\u66f4\u65b0mlocate\u6570\u636e\u5e93\uff1a <\/p>\n\n\n\n \u521b\u5efamlocate\u6570\u636e\u5e93\uff0c\u53ea\u626b\u63cf\/etc\u76ee\u5f55\uff0c\u5199\u5165\u6570\u636e\u5e93\u5230db_file\u6587\u4ef6\uff1a<\/p>\n\n\n\n updatedb\u547d\u4ee4\u7528\u6765\u521b\u5efa\u6216\u66f4\u65b0 slocate\/locate \u547d\u4ee4\u6240\u5fc5\u9700\u7684\u6570\u636e\u5e93\u6587\u4ef6\u3002 updatedb\u547d […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2093"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=2093"}],"version-history":[{"count":14,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2093\/revisions"}],"predecessor-version":[{"id":2578,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2093\/revisions\/2578"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=2093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=2093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=2093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-o<\/td> \u5ffd\u7565\u9ed8\u8ba4\u7684\u6570\u636e\u5e93\u6587\u4ef6\uff0c\u4f7f\u7528\u6307\u5b9a\u7684slocate\u6570\u636e\u5e93\u6587\u4ef6<\/td><\/tr> -U<\/td> \u66f4\u65b0\u6307\u5b9a\u76ee\u5f55\u7684slocate\u6570\u636e\u5e93<\/td><\/tr> -v<\/td> \u663e\u793a\u6267\u884c\u7684\u8be6\u7ec6\u8fc7\u7a0b<\/td><\/tr><\/tbody><\/table>\n\n\n\n [root@linuxcool ~]# locate file.txt <\/pre>\n\n\n\n
[root@linuxcool ~]# updatedb -U \/root\/file\/<\/pre>\n\n\n\n
[root@linuxcool ~]# updatedb<\/pre>\n\n\n\n
[root@linuxcool ~]# updatedb -o db_file -U \/etc<\/pre>\n","protected":false},"excerpt":{"rendered":"