{"id":17518,"date":"2024-11-18T09:01:42","date_gmt":"2024-11-18T01:01:42","guid":{"rendered":"https:\/\/fwq.ai\/blog\/17518\/"},"modified":"2024-11-18T09:01:42","modified_gmt":"2024-11-18T01:01:42","slug":"linux%e6%96%87%e4%bb%b6%e6%9f%a5%e6%89%be%e7%9a%84%e6%96%b9%e6%b3%95%e4%b8%8e%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/17518\/","title":{"rendered":"Linux\u6587\u4ef6\u67e5\u627e\u7684\u65b9\u6cd5\u4e0e\u5e94\u7528"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/887\/227\/170894197448778.jpg\" class=\"aligncenter\" title=\"Linux\u6587\u4ef6\u67e5\u627e\u7684\u65b9\u6cd5\u4e0e\u5e94\u7528\u63d2\u56fe\" alt=\"Linux\u6587\u4ef6\u67e5\u627e\u7684\u65b9\u6cd5\u4e0e\u5e94\u7528\u63d2\u56fe\" \/><\/p>\n<p>Linux\u67e5\u627e\u6587\u4ef6\u662f\u6211\u4eec\u5728\u65e5\u5e38\u8fd0\u7ef4\u5de5\u4f5c\u4e2d\u7ecf\u5e38\u4f1a\u7528\u5230\u7684\u6280\u5de7\u4e4b\u4e00\u3002\u901a\u8fc7\u67e5\u627e\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u5feb\u901f\u5b9a\u4f4d\u7279\u5b9a\u7684\u6587\u4ef6\uff0c\u8fdb\u884c\u76f8\u5e94\u7684\u64cd\u4f5c\u3002\u672c\u6587\u5c06\u4ecb\u7ecdLinux\u4e0b\u5e38\u7528\u7684\u67e5\u627e\u6587\u4ef6\u7684\u6280\u5de7\u4e0e\u5b9e\u8df5\uff0c\u5e26\u6709\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<p>\u4e00\u3001\u4f7f\u7528find\u547d\u4ee4<\/p>\n<p>find\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u975e\u5e38\u5f3a\u5927\u7684\u6587\u4ef6\u67e5\u627e\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u6839\u636e\u6307\u5b9a\u7684\u6761\u4ef6\u5728\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\u9012\u5f52\u67e5\u627e\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684find\u547d\u4ee4\u5b9e\u4f8b\uff1a<\/p>\n<ol>\n<li>\u67e5\u627e\u6240\u6709\u6587\u4ef6\u540d\u4e3aexample.txt\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>find \/path\/to\/search -name example.txt<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u67e5\u627e\u6240\u6709\u4ee5.jpg\u7ed3\u5c3e\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>find \/path\/to\/search -name \"*.jpg\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5728\u6307\u5b9a\u76ee\u5f55\u4e2d\u67e5\u627e\u6240\u6709\u5927\u4e8e100M\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>find \/path\/to\/search -size +100M<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u67e5\u627e\u5e76\u5220\u9664\u6240\u6709\u540d\u4e3atemp.txt\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>find \/path\/to\/search -name temp.txt -delete<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u67e5\u627e\u7279\u5b9a\u7528\u6237\u6240\u6709\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>find \/path\/to\/search -user username<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e8c\u3001\u4f7f\u7528locate\u547d\u4ee4<\/p>\n<p>locate\u547d\u4ee4\u662f\u4e00\u4e2a\u5feb\u901f\u67e5\u627e\u6587\u4ef6\u7684\u5de5\u5177\uff0c\u5b83\u4f1a\u57fa\u4e8e\u7cfb\u7edf\u7684\u6570\u636e\u5e93\u8fdb\u884c\u67e5\u627e\uff0c\u901f\u5ea6\u8f83\u5feb\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684locate\u547d\u4ee4\u5b9e\u4f8b\uff1a<\/p>\n<ol>\n<li>\u641c\u7d22\u6240\u6709\u5305\u542bexample\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>locate example<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u641c\u7d22\u4ee5.jpg\u7ed3\u5c3e\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>locate \"*.jpg\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u66f4\u65b0locate\u7684\u6570\u636e\u5e93\uff1a<\/li>\n<\/ol>\n<pre>sudo updatedb<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e09\u3001\u4f7f\u7528grep\u547d\u4ee4<\/p>\n<p>grep\u547d\u4ee4\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6587\u672c\u641c\u7d22\u5de5\u5177\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u7528\u5b83\u6765\u67e5\u627e\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684grep\u547d\u4ee4\u5b9e\u4f8b\uff1a<\/p>\n<ol>\n<li>\u5728\u6307\u5b9a\u6587\u4ef6\u4e2d\u641c\u7d22\u5305\u542bexample\u7684\u5185\u5bb9\uff1a<\/li>\n<\/ol>\n<pre>grep \"example\" filename<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5728\u6307\u5b9a\u76ee\u5f55\u4e2d\u641c\u7d22\u5305\u542bexample\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>grep -r \"example\" \/path\/to\/search<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u7edf\u8ba1\u5305\u542bexample\u7684\u6587\u4ef6\u6570\u76ee\uff1a<\/li>\n<\/ol>\n<pre>grep -rl \"example\" \/path\/to\/search | wc -l<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fLinux\u4e0b\u67e5\u627e\u6587\u4ef6\u7684\u4e00\u4e9b\u5e38\u7528\u6280\u5de7\u4e0e\u5b9e\u8df5\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u542f\u53d1\u3002\u5728\u5b9e\u9645\u5de5\u4f5c\u4e2d\uff0c\u7ed3\u5408\u8fd9\u4e9b\u6280\u5de7\uff0c\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u67e5\u627e\u548c\u5904\u7406\u6587\u4ef6\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fLinux\u6587\u4ef6\u67e5\u627e\u7684\u65b9\u6cd5\u4e0e\u5e94\u7528\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u67e5\u627e\u6587\u4ef6\u662f\u6211\u4eec\u5728\u65e5\u5e38\u8fd0\u7ef4\u5de5\u4f5c\u4e2d\u7ecf\u5e38\u4f1a\u7528\u5230\u7684\u6280\u5de7\u4e4b\u4e00\u3002\u901a\u8fc7\u67e5\u627e\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u5feb\u901f\u5b9a\u4f4d\u7279\u5b9a\u7684\u6587\u4ef6\uff0c\u8fdb\u884c\u76f8\u5e94\u7684\u64cd\u4f5c\u3002\u672c\u6587\u5c06\u4ecb\u7ecdLinux\u4e0b\u5e38\u7528\u7684\u67e5\u627e\u6587\u4ef6\u7684\u6280\u5de7\u4e0e\u5b9e\u8df5\uff0c\u5e26\u6709\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002 \u4e00\u3001\u4f7f\u7528find\u547d\u4ee4 find\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u975e\u5e38\u5f3a\u5927\u7684\u6587\u4ef6\u67e5\u627e\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u6839\u636e\u6307\u5b9a\u7684\u6761\u4ef6\u5728\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\u9012\u5f52\u67e5\u627e\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684find\u547d\u4ee4\u5b9e\u4f8b\uff1a \u67e5\u627e\u6240\u6709\u6587\u4ef6\u540d\u4e3aexample.txt\u7684\u6587\u4ef6\uff1a find \/path\/to\/search -name example.txt \u767b\u5f55\u540e\u590d\u5236 \u67e5\u627e\u6240\u6709\u4ee5.jpg\u7ed3\u5c3e\u7684\u6587\u4ef6\uff1a find \/path\/to\/search -name &#8220;*.jpg&#8221; \u767b\u5f55\u540e\u590d\u5236 \u5728\u6307\u5b9a\u76ee\u5f55\u4e2d\u67e5\u627e\u6240\u6709\u5927\u4e8e100M\u7684\u6587\u4ef6\uff1a find \/path\/to\/search -size +100M \u767b\u5f55\u540e\u590d\u5236 \u67e5\u627e\u5e76\u5220\u9664\u6240\u6709\u540d\u4e3atemp.txt\u7684\u6587\u4ef6\uff1a find \/path\/to\/search -name temp.txt -delete \u767b\u5f55\u540e\u590d\u5236 \u67e5\u627e\u7279\u5b9a\u7528\u6237\u6240\u6709\u7684\u6587\u4ef6\uff1a find \/path\/to\/search -user username \u767b\u5f55\u540e\u590d\u5236 \u4e8c\u3001\u4f7f\u7528locate\u547d\u4ee4 locate\u547d\u4ee4\u662f\u4e00\u4e2a\u5feb\u901f\u67e5\u627e\u6587\u4ef6\u7684\u5de5\u5177\uff0c\u5b83\u4f1a\u57fa\u4e8e\u7cfb\u7edf\u7684\u6570\u636e\u5e93\u8fdb\u884c\u67e5\u627e\uff0c\u901f\u5ea6\u8f83\u5feb\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684locate\u547d\u4ee4\u5b9e\u4f8b\uff1a \u641c\u7d22\u6240\u6709\u5305\u542bexample\u7684\u6587\u4ef6\uff1a locate example \u767b\u5f55\u540e\u590d\u5236 \u641c\u7d22\u4ee5.jpg\u7ed3\u5c3e\u7684\u6587\u4ef6\uff1a locate &#8220;*.jpg&#8221; \u767b\u5f55\u540e\u590d\u5236 \u66f4\u65b0locate\u7684\u6570\u636e\u5e93\uff1a sudo updatedb \u767b\u5f55\u540e\u590d\u5236 \u4e09\u3001\u4f7f\u7528grep\u547d\u4ee4 grep\u547d\u4ee4\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6587\u672c\u641c\u7d22\u5de5\u5177\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u7528\u5b83\u6765\u67e5\u627e\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684grep\u547d\u4ee4\u5b9e\u4f8b\uff1a \u5728\u6307\u5b9a\u6587\u4ef6\u4e2d\u641c\u7d22\u5305\u542bexample\u7684\u5185\u5bb9\uff1a grep &#8220;example&#8221; filename \u767b\u5f55\u540e\u590d\u5236 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-17518","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/17518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=17518"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/17518\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=17518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=17518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=17518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}