{"id":95843,"date":"2024-05-12T22:54:12","date_gmt":"2024-05-12T14:54:12","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=95843"},"modified":"2024-05-12T22:54:12","modified_gmt":"2024-05-12T14:54:12","slug":"linux-whereis-command","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-whereis-command.html","title":{"rendered":"Linux whereis \u57fa\u7840\u547d\u4ee4"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6709\u65f6\uff0c\u5728\u4f7f\u7528\u547d\u4ee4\u884c\u7684\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u5feb\u901f\u627e\u5230\u67d0\u4e00\u4e2a\u547d\u4ee4\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\u53ef\u4ee5\u9009\u62e9 find \u547d\u4ee4\uff0c\u4f46\u4f7f\u7528\u5b83\u4f1a\u8017\u8d39\u65f6\u95f4\uff0c\u53ef\u80fd\u4e5f\u4f1a\u51fa\u73b0\u610f\u6599\u4e4b\u5916\u7684\u60c5\u51b5\u3002\u6709\u4e00\u4e2a\u4e13\u95e8\u4e3a\u8fd9\u79cd\u60c5\u51b5\u8bbe\u8ba1\u7684\u547d\u4ee4\uff1awhereis\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u5728\u8fd9\u7bc7\u6587\u7ae0\u91cc\uff0c\u6211\u4eec\u4f1a\u901a\u8fc7\u4e00\u4e9b\u4fbf\u4e8e\u7406\u89e3\u7684\u4f8b\u5b50\u6765\u89e3\u91ca\u8fd9\u4e00\u547d\u4ee4\u7684\u57fa\u7840\u5185\u5bb9\u3002\u4f46\u5728\u8fd9\u4e4b\u524d\uff0c\u503c\u5f97\u8bf4\u660e\u7684\u4e00\u70b9\u662f\uff0c\u4e0b\u9762\u51fa\u73b0\u7684\u6240\u6709\u4f8b\u5b50\u90fd\u5728 Ubuntu 16.04 LTS \u4e0b\u6d4b\u8bd5\u8fc7\u3002<\/p>\n

Linux whereis \u547d\u4ee4<\/strong><\/div>\n

whereis \u547d\u4ee4\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u5bfb\u627e\u67d0\u4e00\u547d\u4ee4\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u6e90\u7801\u4ee5\u53ca\u5e2e\u52a9\u9875\u9762\u3002\u4e0b\u9762\u662f\u5b83\u7684\u683c\u5f0f\uff1a<\/p>\n

whereis [options] [-BMS directory... -f] name...<\/pre>\n

\u8fd9\u662f\u8fd9\u4e00\u547d\u4ee4\u7684 man \u9875\u9762\u7ed9\u51fa\u7684\u89e3\u91ca\uff1a<\/p>\n

whereis \u53ef\u4ee5\u67e5\u627e\u6307\u5b9a\u547d\u4ee4\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u3001\u6e90\u6587\u4ef6\u548c\u5e2e\u52a9\u6587\u4ef6\u3002 \u88ab\u627e\u5230\u7684\u6587\u4ef6\u5728\u663e\u793a\u65f6\uff0c\u4f1a\u53bb\u6389\u4e3b\u8def\u5f84\u540d\uff0c\u7136\u540e\u518d\u53bb\u6389\u6587\u4ef6\u7684\uff08\u5355\u4e2a\uff09\u5c3e\u90e8\u6269\u5c55\u540d (\u5982: .c)\uff0c\u6765\u6e90\u4e8e\u6e90\u4ee3\u7801\u63a7\u5236\u7684 s. \u524d\u7f00\u4e5f\u4f1a\u88ab\u53bb\u6389\u3002\u63a5\u4e0b\u6765\uff0cwhereis \u4f1a\u5c1d\u8bd5\u5728\u6807\u51c6\u7684 Linux \u4f4d\u7f6e\u91cc\u5bfb\u627e\u5177\u4f53\u7a0b\u5e8f\uff0c\u4e5f\u4f1a\u5728\u7531 $PATH \u548c $MANPATH \u6307\u5b9a\u7684\u8def\u5f84\u4e2d\u5bfb\u627e\u3002<\/p><\/blockquote>\n

\u4e0b\u9762\u8fd9\u4e9b\u4ee5 Q&A \u5f62\u5f0f\u51fa\u73b0\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u7ed9\u4f60\u4e00\u4e2a\u5173\u4e8e\u5982\u4f55\u4f7f\u7528 whereis \u547d\u4ee4\u7684\u76f4\u89c2\u611f\u53d7\u3002<\/p>\n

Q1. \u5982\u4f55\u7528 whereis \u547d\u4ee4\u5bfb\u627e\u4e8c\u8fdb\u5236\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e?<\/strong><\/div>\n

\u5047\u8bbe\u4f60\u60f3\u627e\uff0c\u6bd4\u5982\u8bf4\uff0cwhereis \u547d\u4ee4\u81ea\u5df1\u6240\u5728\u4f4d\u7f6e\u3002\u4e0b\u9762\u662f\u4f60\u5177\u4f53\u7684\u64cd\u4f5c\uff1a<\/p>\n

whereis whereis<\/pre>\n

\"\"<\/p>\n

\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8f93\u51fa\u7684\u7b2c\u4e00\u4e2a\u8def\u5f84\u624d\u662f\u4f60\u60f3\u8981\u7684\u7ed3\u679c\u3002\u4f7f\u7528 whereis \u547d\u4ee4\uff0c\u540c\u65f6\u4e5f\u4f1a\u663e\u793a\u5e2e\u52a9\u9875\u9762\u548c\u6e90\u7801\u6240\u5728\u8def\u5f84\u3002\uff08\u5982\u679c\u80fd\u627e\u5230\u7684\u60c5\u51b5\u4e0b\u4f1a\u663e\u793a\uff0c\u4f46\u662f\u5728\u8fd9\u4e00\u4f8b\u4e2d\u6ca1\u6709\u627e\u5230\uff09\u6240\u4ee5\u4f60\u5728\u8f93\u51fa\u4e2d\u770b\u89c1\u7684\u7b2c\u4e8c\u4e2a\u8def\u5f84\u5c31\u662f\u5e2e\u52a9\u9875\u9762\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\u3002<\/p>\n

Q2. \u600e\u4e48\u5728\u641c\u7d22\u65f6\u89c4\u5b9a\u53ea\u641c\u7d22\u4e8c\u8fdb\u5236\u6587\u4ef6\u3001\u5e2e\u52a9\u9875\u9762\uff0c\u8fd8\u662f\u6e90\u4ee3\u7801\u5462\uff1f<\/strong><\/div>\n

\u5982\u679c\u4f60\u60f3\u53ea\u641c\u7d22\uff0c\u5047\u8bbe\u8bf4\uff0c\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 -b \u8fd9\u4e00\u547d\u4ee4\u884c\u9009\u9879\u3002\u4f8b\u5982\uff1a<\/p>\n

whereis -b cp<\/pre>\n

\"\"<\/p>\n

\u7c7b\u4f3c\u7684\uff0c -m \u548c -s \u8fd9\u4e24\u4e2a \u9009\u9879\u5206\u522b\u5bf9\u5e94 \u5e2e\u52a9\u9875\u9762\u548c\u6e90\u7801\u3002<\/p>\n

Q3.\u5982\u4f55\u9650\u5236 whereis \u547d\u4ee4\u641c\u7d22\u4f4d\u7f6e\uff1f<\/strong><\/div>\n

\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cwhereis \u662f\u4ece\u7531\u5339\u914d\u7b26\u6240\u5b9a\u4e49\u7684\u786c\u7f16\u7801\u8def\u5f84\u6765\u5bfb\u627e\u6587\u4ef6\u7684\u3002\u4f46\u5982\u679c\u4f60\u60f3\u7684\u8bdd\uff0c\u4f60\u53ef\u4ee5\u7528\u547d\u4ee4\u884c\u9009\u9879\u6765\u9650\u5236\u641c\u7d22\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u53ea\u60f3\u5728 \/usr\/bin \u5bfb\u627e\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u7528 -B \u8fd9\u4e00\u9009\u9879\u6765\u5b9e\u73b0\u3002<\/p>\n

whereis -B \/usr\/bin\/ -f cp<\/pre>\n

\u6ce8\u610f\uff1a\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u65f6\u53ef\u4ee5\u7ed9\u51fa\u591a\u4e2a\u8def\u5f84\u3002\u4f7f\u7528 -f \u8fd9\u4e00\u9009\u9879\u6765\u660e\u786e\u5206\u9694\u76ee\u5f55\u5217\u8868\u548c\u8981\u641c\u7d22\u7684\u6587\u4ef6\u540d\u3002<\/p>\n

\u7c7b\u4f3c\u7684\uff0c\u5982\u679c\u4f60\u60f3\u53ea\u641c\u7d22\u5e2e\u52a9\u6587\u4ef6\u6216\u6e90\u7801\uff0c\u4f60\u53ef\u4ee5\u5bf9\u5e94\u4f7f\u7528 -M \u548c -S \u8fd9\u4e24\u4e2a\u9009\u9879\u3002<\/p>\n

Q4. \u5982\u4f55\u67e5\u770b whereis \u7684\u641c\u7d22\u8def\u5f84?<\/strong><\/div>\n

\u4e0e\u6b64\u76f8\u5bf9\u5e94\u7684\u4e5f\u6709\u4e00\u4e2a\u9009\u9879\u3002\u53ea\u8981\u5728 whereis \u540e\u52a0\u4e0a -l\u3002<\/p>\n

whereis -l<\/pre>\n

\u8fd9\u662f\u4f8b\u5b50\u7684\u90e8\u5206\u8f93\u51fa\u7ed3\u679c\uff1a
\n\"\"<\/p>\n

Q5. \u5982\u4f55\u627e\u5230\u4e00\u4e2a\u6709\u5f02\u5e38\u6761\u76ee\u7684\u547d\u4ee4?<\/strong><\/div>\n

\u5bf9\u4e8e whereis \u547d\u4ee4\u6765\u8bf4\uff0c\u5982\u679c\u4e00\u4e2a\u547d\u4ee4\u5bf9\u6bcf\u4e2a\u663e\u5f0f\u7684\u8bf7\u6c42\u7c7b\u578b\u90fd\u4e0d\u6b62\u4e00\u9879\uff0c\u5219\u8be5\u547d\u4ee4\u88ab\u89c6\u4e3a\u5f02\u5e38\u3002\u4f8b\u5982\uff0c\u6ca1\u6709\u53ef\u7528\u6587\u6863\u7684\u547d\u4ee4\uff0c\u6216\u8005\u5bf9\u5e94\u6587\u6863\u5206\u6563\u5728\u5404\u5904\u7684\u547d\u4ee4\u90fd\u53ef\u4ee5\u7b97\u4f5c\u5f02\u5e38\u547d\u4ee4\u3002 \u5f53\u4f7f\u7528 -u \u8fd9\u4e00\u9009\u9879\uff0cwhereis \u5c31\u4f1a\u663e\u793a\u90a3\u4e9b\u6709\u5f02\u5e38\u6761\u76ee\u7684\u547d\u4ee4\u3002<\/p>\n

\u4f8b\u5982\uff0c\u4e0b\u9762\u8fd9\u4e00\u4f8b\u5b50\u5c31\u663e\u793a\uff0c\u5728\u5f53\u524d\u76ee\u5f55\u4e2d\uff0c\u6ca1\u6709\u5bf9\u5e94\u6587\u6863\u6216\u6709\u591a\u4e2a\u6587\u6863\u7684\u547d\u4ee4\u3002<\/p>\n

whereis -m -u *<\/pre>\n
\u603b\u7ed3<\/strong><\/div>\n

\u6211\u89c9\u5f97\uff0cwhereis \u4e0d\u662f\u90a3\u79cd\u4f60\u9700\u8981\u7ecf\u5e38\u4f7f\u7528\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u4f46\u5728\u9047\u5230\u67d0\u4e9b\u7279\u6b8a\u60c5\u51b5\u65f6\uff0c\u5b83\u7edd\u5bf9\u4f1a\u8ba9\u4f60\u7684\u751f\u6d3b\u53d8\u5f97\u8f7b\u677e\u3002\u6211\u4eec\u5df2\u7ecf\u6d89\u53ca\u4e86\u8fd9\u4e00\u5de5\u5177\u63d0\u4f9b\u7684\u4e00\u4e9b\u91cd\u8981\u547d\u4ee4\u884c\u9009\u9879\uff0c\u6240\u4ee5\u8981\u6ce8\u610f\u7ec3\u4e60\u3002\u60f3\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u76f4\u63a5\u53bb\u770b\u5b83\u7684 man \u9875\u9762\u5427\u3002<\/p>\n

via: https:\/\/www.howtoforge.com\/linux-whereis-command\/<\/a><\/p>\n

\u4f5c\u8005\uff1aHimanshu Arora<\/a> \u8bd1\u8005\uff1awenwensnow<\/a> \u6821\u5bf9\uff1awxy<\/a><\/p>\n

\u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n


\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-9384-1.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/linux-whereis-command.html<\/a>\u7f16\u8f91\uff1a\u51af\u632f\u534e\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u6709\u65f6\uff0c\u5728\u4f7f\u7528\u547d\u4ee4\u884c\u7684\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u5feb\u901f\u627e\u5230\u67d0\u4e00\u4e2a\u547d\u4ee4\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\u53ef\u4ee5\u9009\u62e9 find […]<\/p>\n","protected":false},"author":63,"featured_media":95864,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-95843","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/95843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=95843"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/95843\/revisions"}],"predecessor-version":[{"id":291622,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/95843\/revisions\/291622"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/95864"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=95843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=95843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=95843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}