{"id":2889,"date":"2017-11-29T21:56:29","date_gmt":"2017-11-29T13:56:29","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=2889"},"modified":"2025-08-20T13:39:01","modified_gmt":"2025-08-20T05:39:01","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8-linux-%e4%b8%ad%e6%9f%a5%e6%89%be%e4%b8%80%e4%b8%aa%e6%96%87%e4%bb%b6-2","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/linux\/%e5%a6%82%e4%bd%95%e5%9c%a8-linux-%e4%b8%ad%e6%9f%a5%e6%89%be%e4%b8%80%e4%b8%aa%e6%96%87%e4%bb%b6-2\/","title":{"rendered":"\u5982\u4f55\u5728 Linux \u4e2d\u67e5\u627e\u4e00\u4e2a\u6587\u4ef6"},"content":{"rendered":"<p>\u7b2c\u4e00\u6b65\u8981\u505a\u7684\u662f<strong>\u901a\u8fc7 SSH \u8fde\u63a5\u5230\u4f60\u7684 Linux<\/strong>\u3002\u5728 Linux \u4e2d\u67e5\u627e\u6587\u4ef6\u6709\u4e24\u79cd\u65b9\u6cd5\u3002\u4e00\u79cd\u662f\u4f7f\u7528find\u00a0\u547d\u4ee4\uff0c\u53e6\u5916\u4e00\u79cd\u662f\u4f7f\u7528locate\u00a0\u547d\u4ee4\u3002<\/p>\n<p>&nbsp;<\/p>\n<div><strong>find \u547d\u4ee4<\/strong><\/div>\n<p>\u4f7f\u7528 Linux find \u547d\u4ee4\u53ef\u4ee5\u7528\u4e0d\u540c\u7684\u641c\u7d22\u6807\u51c6\u5982\u540d\u5b57\u3001\u7c7b\u578b\u3001\u6240\u5c5e\u4eba\u3001\u5927\u5c0f\u7b49\u6765\u641c\u7d22\u76ee\u5f55\u6811\u3002\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre># find path expression search-term<\/pre>\n<p>\u4e0b\u9762\u662f\u4f7f\u7528 find \u547d\u4ee4\u6839\u636e\u6587\u4ef6\u540d\u6765\u67e5\u627e\u7279\u5b9a\u6587\u4ef6\u7684\u4e00\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<pre># find -name test.file<\/pre>\n<p>\u547d\u4ee4\u4f1a\u641c\u7d22\u6574\u4e2a\u76ee\u5f55\u6811\u6765\u67e5\u627e\u540d\u4e3atest.file\u00a0\u7684\u6587\u4ef6\uff0c\u5e76\u4e14\u4f1a\u63d0\u4f9b\u5176\u5b58\u653e\u4f4d\u7f6e\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4f60 Linux \u4e0a\u4e00\u4e2a\u5b58\u5728\u7684\u6587\u4ef6\u540d\u6765\u5c1d\u8bd5\u4e00\u4e0b\u3002<br \/>\nfind \u547d\u4ee4\u6709\u65f6\u4f1a\u82b1\u8d39\u51e0\u5206\u949f\u6765\u67e5\u627e\u6574\u4e2a\u76ee\u5f55\u6811\uff0c\u5c24\u5176\u662f\u5982\u679c\u7cfb\u7edf\u4e2d\u6709\u5f88\u591a\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u8bdd\u3002\u8981\u663e\u8457\u51cf\u5c11\u65f6\u95f4\uff0c\u4f60\u53ef\u4ee5\u6307\u5b9a\u641c\u7d22\u7684\u76ee\u5f55\u3002\u6bd4\u5982\uff0c\u5982\u679c\u4f60\u77e5\u9053\u00a0\/var\u4e2d\u5b58\u5728\u00a0test.file\uff0c\u90a3\u5c31\u6ca1\u6709\u5fc5\u8981\u641c\u7d22\u5176\u5b83\u76ee\u5f55\u3002\u8fd9\u6837\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<pre># find \/var -name test.file<\/pre>\n<p>find \u8fd8\u53ef\u4ee5\u6839\u636e\u65f6\u95f4\u3001\u5927\u5c0f\u3001\u6240\u5c5e\u4eba\u3001\u6743\u9650\u7b49\u9009\u9879\u641c\u7d22\u6587\u4ef6\u3002\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u8fd9\u4e9b\u9009\u9879\u7684\u4fe1\u606f\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u67e5\u770bLinux find \u547d\u4ee4\u7684\u624b\u518c\u3002<\/p>\n<pre># man find<\/pre>\n<div><strong>locate \u547d\u4ee4<\/strong><\/div>\n<p>\u8981\u5728Linux\u4e2d\u4f7f\u7528locate\u547d\u4ee4\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\u3002<br \/>\n\u5982\u679c\u4f60\u6b63\u5728\u4f7f\u7528 Ubuntu\uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u5b89\u88c5 locate\uff1a<\/p>\n<pre># apt-get update# apt-get install mlocate<\/pre>\n<p>\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f CentOS \uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u5b89\u88c5 locate\uff1a<\/p>\n<pre># yum install mlocate<\/pre>\n<p>locate \u662f\u4e00\u79cd\u6bd4 find \u66f4\u5feb\u7684\u65b9\u5f0f\uff0c\u56e0\u4e3a\u5b83\u5728\u6570\u636e\u5e93\u4e2d\u67e5\u627e\u6587\u4ef6\u3002\u8981\u66f4\u65b0\u641c\u7d22\u6570\u636e\u5e93\uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<pre># updatedb<\/pre>\n<p>\u4f7f\u7528 locate \u67e5\u627e\u6587\u4ef6\u7684\u8bed\u6cd5\uff1a<\/p>\n<pre># locate test.file<\/pre>\n<p>\u5c31\u50cf find \u547d\u4ee4\u4e00\u6837\uff0clocate \u4e5f\u6709\u5f88\u591a\u9009\u9879\u6765\u8fc7\u6ee4\u8f93\u51fa\u3002\u8981\u4e86\u89e3\u66f4\u591a\u4f60\u53ef\u4ee5\u67e5\u770bLinux Locate \u547d\u4ee4\u7684\u624b\u518c\u3002<\/p>\n<pre># man locate<\/pre>\n<p>\u5e0c\u671b\u8fd9\u7bc7\u6587\u80fd\u591f\u5e2e\u5230\u60a8\uff0c\u8c22\u8c22\u3002<\/p>\n<blockquote><p>\u539f\u6587\u6765\u81ea\uff1a<a href=\"https:\/\/linux.cn\/article-8016-1.html\" target=\"_blank\" rel=\"noopener\">https:\/\/linux.cn\/article-8016-1.html<\/a><\/p>\n<p>\u672c\u6587\u5730\u5740\uff1ahttps:\/\/www.linuxprobe.com\/how-linux-find.html<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c\u4e00\u6b65\u8981\u505a\u7684\u662f\u901a\u8fc7 SSH \u8fde\u63a5\u5230\u4f60\u7684 Linux\u3002\u5728 Linux \u4e2d\u67e5\u627e\u6587\u4ef6\u6709\u4e24\u79cd\u65b9\u6cd5\u3002\u4e00\u79cd\u662f\u4f7f\u7528find\u00a0 &#8230; <a title=\"\u5982\u4f55\u5728 Linux \u4e2d\u67e5\u627e\u4e00\u4e2a\u6587\u4ef6\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/linux\/%e5%a6%82%e4%bd%95%e5%9c%a8-linux-%e4%b8%ad%e6%9f%a5%e6%89%be%e4%b8%80%e4%b8%aa%e6%96%87%e4%bb%b6-2\/\" aria-label=\"\u9605\u8bfb \u5982\u4f55\u5728 Linux \u4e2d\u67e5\u627e\u4e00\u4e2a\u6587\u4ef6\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49],"tags":[868,1698,1697],"class_list":["post-2889","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux","tag-1698","tag-1697"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=2889"}],"version-history":[{"count":3,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2889\/revisions"}],"predecessor-version":[{"id":10026,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2889\/revisions\/10026"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=2889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=2889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=2889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}