{"id":295213,"date":"2024-12-27T20:09:12","date_gmt":"2024-12-27T12:09:12","guid":{"rendered":"https:\/\/gulass.cn\/lmlxjkssswjd.html"},"modified":"2024-12-27T20:09:12","modified_gmt":"2024-12-27T12:09:12","slug":"lmlxjkssswjd","status":"publish","type":"post","link":"https:\/\/gulass.cn\/lmlxjkssswjd.html","title":{"rendered":"Linux locate\u547d\u4ee4\u8be6\u89e3\uff1a\u5feb\u901f\u641c\u7d22\u6587\u4ef6\u7684\u65b9\u6cd5\u4e0e\u6ce8\u610f\u4e8b\u9879"},"content":{"rendered":"

\u4e00.locate\uff08\u641c\u7d22\u6587\u4ef6\uff09<\/p>\n

1.\u547d\u4ee4<\/a>\u683c\u5f0f<\/p>\n

locate\u6587\u4ef6\u540d<\/p>\n

\u8bf4\u660e\uff1alocate\u547d\u4ee4\u4e0d\u5728\u7cfb\u7edf\u4e2d\u641c\u7d22\u6587\u4ef6\uff08\u5373\u4e0d\u904d\u5386\u6574\u4e2a\u7cfb\u7edf\uff09linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/strong>\uff0c\u800c\u662f\u5728\/var\/lib\/mlocate\uff08centos7\u4e2d\u56e0\u6b64\u76ee\u5f55\uff0c\u53ef\u4f7f\u7528locatelocate\u547d\u4ee4\u67e5\u770b\u6b64\u76ee\u5f55\u8def\u5f84\uff09\u6570\u636e\u5e93\u4e2d\u641c\u7d22\uff0c\/var\/lib\/mlocate\u6570\u636e\u5e93\u9ed8\u8ba4\u6bcf\u665a\u66f4\u65b0\u4e00\u6b21\uff0c\u8981\u67e5\u627e\u65b0\u521b\u5efa\u7684\u6587\u4ef6\u5c31\u8981\u53bb\u66f4\u65b0\uff08\u901a\u8fc7updatedb\u547d\u4ee4\uff09\u6b64\u6570\u636e\u5e93\u540e\u518d\u8fdb\u884c\u641c\u7d22<\/p>\n

2.\u4f18\u70b9<\/p>\n

\u5728\u540e\u53f0\u6570\u636e\u5e93\u4e2d\u6309\u6587\u4ef6\u540d\u8fdb\u884c\u641c\u7d22\uff0c\u6240\u4ee5\u641c\u7d22\u901f\u7387\u5feb<\/p>\n

3.\u7f3a\u70b9<\/p>\n

\u53ea\u80fd\u6309\u6587\u4ef6\u540d\u641c\u7d22<\/p>\n

4.\u6ce8\u610f<\/p>\n

locate\u6839\u636e\u914d\u7f6e\u6587\u4ef6\/etc\/updatedb.conf\u8fdb\u884c\u641c\u7d22\uff0c\u914d\u7f6e\u6587\u4ef6\u7684\u5185\u5bb9\u5982\u53f3\u56fe<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

PRUNE_BIND_MOUNTS=\"yes\"\u8868\u793a\u5f00\u542f\u641c\u7d22\u9650\u5236<\/p>\n

PRUNE_BIND_MOUNTS=\"no\"\u8868\u793a\u5173\u6389\u641c\u7d22\u9650\u5236<\/p>\n

PRUNEFS\u8868\u793a\u641c\u7d22\u65f6\u4e0d\u641c\u7d22\u7684\u6587\u4ef6\u7cfb\u7edf<\/p>\n

PRUNENAMES\u8868\u793a\u641c\u7d22\u65f6\u4e0d\u641c\u7d22\u7684\u6587\u4ef6\u7c7b\u578b<\/p>\n

PRUNEPATHS\u8868\u793a\u641c\u7d22\u65f6\u4e0d\u641c\u7d22\u7684\u8def\u5f84<\/p>\n

\u4e8c.whereis\uff08\u641c\u7d22\u547d\u4ee4\uff09<\/p>\n

1.\u547d\u4ee4\u683c\u5f0f<\/p>\n

whereis\u547d\u4ee4\u540d<\/p>\n

\u8bf4\u660e\uff1a\u641c\u7d22\u5916\u90e8\u547d\u4ee4\u6240\u5728\u8def\u5f84\u53ca\u5e2e\u52a9\u6587\u6863\u6240\u5728\u4f4d\u7f6e\uff08Linux<\/a>\u7684shell\u5916\u7f6e\u547d\u4ee4\u4e0d\u80fd\u901a\u8fc7whereis\u627e\u5230\u547d\u4ee4\u8def\u5f84\uff0c\u53ea\u80fd\u770b\u89c1\u5e2e\u52a9\u6587\u6863\u7684\u8def\u5f84\uff0c\u5982pwd\u3001cd\uff09<\/p>\n

-b\u53ea\u67e5\u770b\u547d\u4ee4\u6240\u5728\u4f4d\u7f6e\uff08\u5373\u547d\u4ee4\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff09<\/p>\n

-m\u53ea\u67e5\u627e\u5e2e\u52a9\u6587\u6863\u6240\u5728\u4f4d\u7f6e<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

\u4e09.which\uff08\u641c\u7d22\u547d\u4ee4\uff09<\/p>\n

1.\u547d\u4ee4\u683c\u5f0f<\/p>\n

which\u547d\u4ee4\u540d<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

\u8bf4\u660e\uff1a\u641c\u7d22\u5916\u90e8\u547d\u4ee4\u6240\u5728\u8def\u5f84\u53ca\u522b\u79f0\uff08\u4e0d\u662f\u6240\u6709\u547d\u4ee4\u90fd\u6709\u522b\u79f0\uff0cLinux<\/a>\u7684shell\u5916\u7f6e\u547d\u4ee4\u672a\u80fd\u7528\u6b64\u547d\u4ee4\uff09<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

\u6ce8\u610f\uff1a<\/p>\n

\u5728Linux\u4e2d\u8981\u60f3\u6267\u884c\u4e00\u4e2a\u547d\u4ee4\u987b\u8981\u7528\u7edd\u5bf9\u8def\u5f84\uff0c\u56e0\u4e3a\u7cfb\u7edf\u5b9a\u4e49\u4e86\u73af\u5883\u53d8\u91cfPATH\uff08\u5373\u7cfb\u7edf\u641c\u7d22\u547d\u4ee4\u7684\u8def\u5f84\uff09\uff0c\u5f53\u6267\u884c\u4e00\u4e2a\u547d\u4ee4\u65f6\uff0c\u4f1a\u5728PATH\u6307\u5b9a\u7684\u8def\u5f84\u4e2d\u641c\u7d22\u662f\u5426\u6709\u8fd9\u6837\u4e00\u4e2a\u6267\u884c\u6587\u4ef6\u6216\u5219\u811a\u672c\u5b58\u5728\uff08\u7531\u4e8e\u73af\u5883\u53d8\u91cf\u7684\u5b58\u5728\uff0c\u6240\u4ee5\u7cfb\u7edf\u547d\u4ee4\u53ef\u4ee5\u4e0d\u6253\u7edd\u5bf9\u8def\u5f84\uff09\uff0c\u82e5\u81ea\u5df1\u5b9a\u4e49\u4e86\u4e00\u4e2a\u6267\u884c\u6587\u4ef6\u987b\u8981\u6267\u884c\u65f6\u5c31\u8981\u6253\u4e0a\u7edd\u5bf9\u8def\u5f84\uff0c\u6216\u5219\u628a\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u7f6e\u4e8ePATH\u73af\u5883\u53d8\u91cf\u4e0b\u3002linux\u4e0b\u67e5\u770b\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n

\u56db.find\uff08\u641c\u7d22*\u6587\u4ef6*\uff09<\/p>\n

1.\u547d\u4ee4\u683c\u5f0f<\/p>\n

find[\u641c\u7d22\u8303\u56f4][\u641c\u7d22\u6761\u4ef6]<\/p>\n

\u8bf4\u660e\uff1afind\u547d\u4ee4\u5bf9\u6587\u4ef6\u8fdb\u884c\u641c\u7d22\u7684\u65f6\u4faf\u5b8c\u5168\u5339\u914d\u6587\u4ef6\u540d\uff0c\u5018\u82e5\u8fdb\u884c\u6a21\u7cca\u641c\u7d22\u5219\u4f7f\u7528\u8f6c\u4e49\u5339\u914d<\/p>\n

Linux\u4e2d\u952e\u503c\u6709\uff1a*\u5339\u914d\u4efb\u610f\u5185\u5bb9<\/p>\n

\uff1f\u5339\u914d\u4e00\u4e2a\u4efb\u610f\u5b57\u7b26<\/p>\n

\u200b[]\u5339\u914d\u4e2d\u62ec\u5f27\u5185\u4efb\u4e00\u5b57\u7b26<\/p>\n

2.\u793a\u4f8b<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

\u5728\u6839\u76ee\u5f55\u4e0b\u641c\u7d22\u540d\u4e3ainitial-setup-ks.cfg\u7684\u6587\u4ef6\uff0c\u6ce8\u6839\u76ee\u5f55\u4e0b\u641c\u7d22\u76f8\u5f53\u4e8e\u904d\u5386\u6839\u76ee\u5f55linux\u83b7\u53d6\u5f53\u524d\u65f6\u95f4\uff0c\u4f1a\u82b1\u8d39\u8d44\u6e90<\/p>\n

\u5728\/root\u76ee\u5f55\u4e0b\u501f\u52a9\u952e\u503c\u5206\u522b\u641c\u7d22\u6587\u4ef6\u540d\u4e3a\u4ee5a\u3001b\u5f00\u5934\u4ee5\u4efb\u610f\u5b57\u7b26\u7ed3\u5c3e\u7684\u6587\u4ef6<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

-name\u6839\u636e\u6587\u4ef6\u540d\u5b8c\u5168\u5339\u914d\u641c\u7d22<\/p>\n

-iname\u6839\u636e\u6587\u4ef6\u540d\u4e0d\u5206\u8fa8\u5927\u5c0f\u5199\u641c\u7d22<\/p>\n

-user\u6839\u636e\u6240\u6709\u8005\u8fdb\u884c\u641c\u7d22linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/strong>\uff0c\u524d\u9762\u4e3aLinux\u7684\u767b\u9646\u5e10\u6237\u540d<\/p>\n

-nouser\u67e5\u627e\u6ca1\u6709\u6240\u6709\u8005\u7684\u6587\u4ef6\uff08\u4e0d\u662f\u6240\u6709\u7684\u6ca1\u6709\u6240\u6709\u8005\u7684\u6587\u4ef6\u90fd\u662f\u5783\u573e\u6587\u4ef6\uff0c\u5185\u6838\u5f62\u6210\u7684\u6839\u76ee\u5f55proc\u3001sys\u8def\u5f84\u4e0b\u7684\uff0c\u6216\u5219\u5916\u6765\u6587\u4ef6\u5373\u5916\u63a5\u76d8\u5185\u7684\u6587\u4ef6\u4f1a\u6ca1\u6709\u6240\u6709\u8005linux \u5220\u9664\u6587\u4ef6\uff0c\u4f46\u4e0d\u662f\u5783\u573e\u6587\u4ef6\uff09<\/p>\n

-mtime\u6839\u636e\u66f4\u6539\u7684\u65f6\u95f4\u8303\u56f4\u641c\u7d22\u6587\u4ef6<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

-atime\u6309\u7167\u6587\u4ef6\u7684\u8bbf\u95ee\u65f6\u95f4\u641c\u7d22<\/p>\n

-ctime\u6309\u7167\u6587\u4ef6\u5c5e\u6027\u6539\u53d8\u7684\u65f6\u95f4\u641c\u7d22<\/p>\n

-size\u6309\u7167\u6587\u4ef6\u5927\u5c0f\u641c\u7d22<\/p>\n

-inum\u6309\u7167\u6587\u4ef6\u7684i\u8282\u70b9\u641c\u7d22<\/p>\n

linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528_linux \u901a\u914d\u7b26\u7684\u4f7f\u7528<\/p>\n

\u67e5\u627eroot\u76ee\u5f55\u4e0b\u5c0f\u4e8e10k\u5927\u4e8e30k\u7684\u6587\u4ef6\uff08-a\u8868\u793a\u4e0eand\uff0c-o\u8868\u793a\u6216or\uff09<\/p>\n

\u67e5\u627eroot\u76ee\u5f55\u4e0b\u5c0f\u4e8e10k\u5927\u4e8e30k\u7684\u6587\u4ef6\u5e76\u663e\u793a\u6587\u4ef6\u8be6\u5c3d\u4fe1\u606f\uff08-exec\u547d\u4ee4{};\u5bf9\u641c\u7d22\u7ed3\u679c\u8fdb\u884c\u64cd\u4f5c\uff09<\/p>\n

\u4e94.grep\uff08\u641c\u7d22\u5b57\u7b26\u4e32\uff09<\/p>\n

1.\u547d\u4ee4\u683c\u5f0f<\/p>\n

grep[\u9009\u9879]\u5b57\u7b26\u4e32\u6587\u4ef6\u540d<\/p>\n

\u8bf4\u660e\uff1agrep\u547d\u4ee4\u662f\u5728\u6587\u4ef6\u4e2d\u641c\u7d22\u7b26\u5408\u6761\u4ef6\u7684\u5b57\u7b26\u4e32\uff0c\u5982\u9700\u5339\u914d\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u8fdb\u884c\u5305\u542b\u5339\u914d<\/p>\n

2.\u9009\u9879<\/p>\n

-i\u5ffd\u89c6\u5927\u5c0f\u5199<\/p>\n

-v\u6392\u9664\u6307\u5b9a\u7684\u5b57\u7b26\u4e32<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e00.locate\uff08\u641c\u7d22\u6587\u4ef6\uff09locate\u6309\u7167\u914d\u7f6e\u6587\u4ef6\/etc\/updatedb.conf\u8fdb\u884c\u641c\u7d22\uff0c\u914d\u7f6e\u6587\u4ef6\u7684\u5185\u5bb9\u5982\u4e0b\u56fe\u8bf4\u660e\uff1afind\u547d\u4ee4\u5bf9\u6587\u4ef6\u8fdb\u884c\u641c\u7d22\u7684\u65f6\u5019\u5b8c\u5168\u5339\u914d\u6587\u4ef6\u540d\uff0c\u82e5\u60f3\u8fdb\u884c\u6a21\u7cca\u641c\u7d22\u5219\u4f7f\u7528\u901a\u914d\u7b26\u5339\u914d\u5728\/root\u76ee\u5f55\u4e0b\u5229\u7528\u901a\u914d\u7b26\u5206\u522b\u641c\u7d22\u6587\u4ef6\u540d\u4e3a\u4ee5a\u3001b\u5f00\u5934\u4ee5\u4efb\u610f\u5b57\u7b26\u7ed3\u5c3e\u7684\u6587\u4ef6<\/p>\n","protected":false},"author":1,"featured_media":295214,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[3893,109,5224,5225,1006],"class_list":["post-295213","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-fml-5","tag-linux","tag-lml-7","tag-uml-7","tag-hjbl"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/295213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=295213"}],"version-history":[{"count":0,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/295213\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/295214"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=295213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=295213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=295213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}