{"id":4814,"date":"2025-08-06T09:20:31","date_gmt":"2025-08-06T00:20:31","guid":{"rendered":"https:\/\/eternalsphere.net\/echoes\/?p=4814"},"modified":"2026-06-06T09:41:02","modified_gmt":"2026-06-06T00:41:02","slug":"kzi35wbir920qoa","status":"publish","type":"post","link":"https:\/\/eternalsphere.net\/echoes\/index.php\/2025\/08\/06\/kzi35wbir920qoa\/","title":{"rendered":"Linux \u4e2d\u5982\u4f55\u6309\u4fee\u6539\u65f6\u95f4\u5217\u51fa\u6240\u6709\u6587\u4ef6\u548c\u76ee\u5f55"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u67e5\u770b<strong>\u54ea\u4e9b\u6587\u4ef6\u6216\u76ee\u5f55\u6700\u8fd1\u88ab\u4fee\u6539\u8fc7<\/strong>\uff0c\u6216\u8005\u6309\u7167<strong>\u4fee\u6539\u65f6\u95f4\u6392\u5e8f\u5168\u76d8\u6587\u4ef6<\/strong>\u6765\u6392\u67e5\u7cfb\u7edf\u53d8\u66f4\u3001\u8ddf\u8e2a\u914d\u7f6e\u3001\u6216\u5236\u5b9a\u5907\u4efd\u7b56\u7565\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 <code>find<\/code>\u3001<code>sort<\/code> \u548c <code>awk<\/code> \u7b49\u547d\u4ee4\uff0c\u5c06\u6587\u4ef6\u53ca\u76ee\u5f55\u6309\u4fee\u6539\u65f6\u95f4\u6392\u5e8f\uff0c\u5e76\u4ee5<strong>\u4eba\u7c7b\u53ef\u8bfb\u683c\u5f0f<\/strong>\u8f93\u51fa\u3002\u53ef\u7528\u4e8e\u5ba1\u8ba1\u3001\u65e5\u5fd7\u5206\u6790\u3001\u7cfb\u7edf\u7ba1\u7406\u7b49\u573a\u666f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udee0 \u9700\u6c42\u80cc\u666f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5047\u8bbe\u4f60\u60f3\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u67e5\u770b\u67d0\u4e2a\u76ee\u5f55\uff08\u5982 <code>\/home<\/code>\uff09\u4e0b\uff0c\u5305\u62ec\u6240\u6709\u5b50\u76ee\u5f55\u4e0e\u6587\u4ef6\uff1b<\/li>\n\n\n\n<li>\u8fd9\u4e9b\u5185\u5bb9\u8981\u6309\u7167<strong>\u4fee\u6539\u65f6\u95f4\u6392\u5e8f<\/strong>\uff1b<\/li>\n\n\n\n<li>\u65f6\u95f4\u5fc5\u987b\u662f<strong>\u4eba\u7c7b\u53ef\u8bfb\u683c\u5f0f<\/strong>\uff0c\u5982 <code>2025-08-03 14:20:55<\/code>\uff1b<\/li>\n\n\n\n<li>\u663e\u793a<strong>\u65b0\u4fee\u6539\u7684\u5185\u5bb9\u6392\u5728\u6700\u524d\u9762<\/strong>\uff08\u4ece\u65b0\u5230\u65e7\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \u63a8\u8350\u547d\u4ee4\uff1a\u53ef\u8bfb\u65f6\u95f4 + \u6392\u5e8f + \u663e\u793a\u76ee\u5f55\u548c\u6587\u4ef6<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>find \/your\/path -printf '%T@|%p\\n' 2&gt;\/dev\/null | sort -nr | awk -F'|' '{ <br>    cmd=\"date -d @\"$1\" \\\"+%Y-%m-%d %H:%M:%S\\\"\"; <br>    cmd | getline time; <br>    close(cmd); <br>    print time, $2 <br>}'<br><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06 <code>\/your\/path<\/code> \u66ff\u6362\u4e3a\u4f60\u8981\u68c0\u67e5\u7684\u76ee\u5f55\u8def\u5f84\uff08\u5982 <code>\/home<\/code>\u3001<code>\/var\/log<\/code> \u7b49\uff09\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udccc \u8f93\u51fa\u793a\u4f8b\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>2025-08-03 14:20:55 \/home\/user\/.config\/some_app\/settings.conf<br>2025-08-03 14:18:07 \/home\/user\/Documents\/report.docx<br>2025-08-03 13:47:30 \/home\/user\/Downloads\/archive.zip<br>...<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcd8 \u53c2\u6570\u89e3\u91ca<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7ec4\u4ef6<\/th><th>\u542b\u4e49<\/th><\/tr><\/thead><tbody><tr><td><code>find \/your\/path<\/code><\/td><td>\u904d\u5386\u76ee\u6807\u8def\u5f84\u4e0b\u6240\u6709\u6587\u4ef6\u4e0e\u76ee\u5f55<\/td><\/tr><tr><td>`-printf &#8216;%T@<\/td><td>%p\\n&#8217;`<\/td><\/tr><tr><td><code>sort -nr<\/code><\/td><td>\u6309\u65f6\u95f4\u6233\u4ece\u65b0\u5230\u65e7\u6392\u5e8f<\/td><\/tr><tr><td>`awk -F&#8217;<\/td><td>&#8216;`<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udce4 \u53ef\u9009\uff1a\u5c06\u7ed3\u679c\u8f93\u51fa\u5230\u6587\u4ef6<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>... &gt; ~\/file-change-log.txt<br><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>find \/var\/log -printf '%T@|%p\\n' 2&gt;\/dev\/null | sort -nr | awk -F'|' '{ <br>    cmd=\"date -d @\"$1\" \\\"+%Y-%m-%d %H:%M:%S\\\"\"; <br>    cmd | getline time; <br>    close(cmd); <br>    print time, $2 <br>}' &gt; ~\/log-change-history.txt<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">\u26a0 \u6ce8\u610f\u4e8b\u9879<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u67d0\u4e9b\u76ee\u5f55\u53ef\u80fd\u65e0\u6743\u9650\u8bbf\u95ee\uff0c\u53ef\u52a0 <code>sudo<\/code> \u8fd0\u884c\uff1a bashCopyEdit<code>sudo find \/etc -printf ...<\/code><\/li>\n\n\n\n<li>\u547d\u4ee4\u8fd0\u884c\u901f\u5ea6\u53d6\u51b3\u4e8e\u6587\u4ef6\u6570\u91cf\uff0c\u907f\u514d\u5728\u6839\u76ee\u5f55 <code>\/<\/code> \u5168\u76d8\u904d\u5386\uff0c\u9664\u975e\u4f60\u660e\u786e\u77e5\u9053\u81ea\u5df1\u5728\u505a\u4ec0\u4e48\u3002<\/li>\n\n\n\n<li>\u5728\u975e GNU \u7cfb\u7edf\uff08\u5982 macOS\uff09\u4e2d\uff0c\u9700\u7528 <code>gdate<\/code> \u66ff\u4ee3 <code>date<\/code>\uff08\u53ef\u901a\u8fc7 <code>brew install coreutils<\/code> \u5b89\u88c5\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udde9 \u5ef6\u4f38\u7528\u9014<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u2705 \u6700\u8fd1\u4fee\u6539\u7684\u524d 20 \u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\uff1a<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>... | head -n 20<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u2705 \u7b5b\u9009\u67d0\u7c7b\u578b\u6587\u4ef6\uff08\u5982 <code>.log<\/code>\uff09\uff1a<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>find \/var\/log -name \"*.log\" -printf '%T@|%p\\n' ...<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \u603b\u7ed3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u7ec4\u5408 <code>find<\/code>\u3001<code>sort<\/code> \u4e0e <code>awk<\/code>\uff0c\u6211\u4eec\u53ef\u4ee5\u7075\u6d3b\u3001\u6e05\u6670\u5730\u5217\u51fa\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u4e0e\u76ee\u5f55\uff0c\u6309\u4fee\u6539\u65f6\u95f4\u6392\u5e8f\u3002\u5b83\u9002\u7528\u4e8e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u914d\u7f6e\u53d8\u66f4\u8ffd\u8e2a<\/li>\n\n\n\n<li>\u7cfb\u7edf\u5b89\u5168\u5ba1\u8ba1<\/li>\n\n\n\n<li>\u81ea\u52a8\u5316\u5907\u4efd<\/li>\n\n\n\n<li>\u7528\u6237\u64cd\u4f5c\u5206\u6790<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u638c\u63e1\u8fd9\u7c7b\u547d\u4ee4\uff0c\u662f\u6bcf\u4f4d Linux \u7528\u6237\u548c\u7cfb\u7edf\u7ba1\u7406\u5458\u7684\u57fa\u7840\u6280\u80fd\u4e4b\u4e00\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u67e5\u770b\u54ea\u4e9b\u6587\u4ef6\u6216\u76ee\u5f55\u6700\u8fd1\u88ab\u4fee\u6539\u8fc7\uff0c\u6216\u8005\u6309\u7167\u4fee\u6539\u65f6\u95f4\u6392\u5e8f\u5168\u76d8\u6587\u4ef6\u6765\u6392\u67e5\u7cfb\u7edf\u53d8\u66f4\u3001\u8ddf\u8e2a\u914d\u7f6e\u3001\u6216\u5236\u5b9a\u5907\u4efd\u7b56\u7565\u3002 \u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 find\u3001sort \u548c awk \u7b49\u547d\u4ee4\uff0c\u5c06\u6587\u4ef6\u53ca\u76ee\u5f55\u6309\u4fee\u6539\u65f6\u95f4\u6392\u5e8f\uff0c\u5e76\u4ee5\u4eba\u7c7b\u53ef\u8bfb\u683c\u5f0f\u8f93\u51fa\u3002\u53ef\u7528\u4e8e\u5ba1\u8ba1\u3001\u65e5\u5fd7\u5206\u6790\u3001\u7cfb\u7edf\u7ba1\u7406\u7b49\u573a\u666f\u3002 \ud83d\udee0 \u9700\u6c42\u80cc\u666f \u5047\u8bbe\u4f60\u60f3\uff1a \u2705 \u63a8\u8350\u547d\u4ee4\uff1a\u53ef\u8bfb\u65f6\u95f4 + \u6392\u5e8f + \u663e\u793a\u76ee\u5f55\u548c\u6587\u4ef6 find \/your\/path -printf &#8216;%T@|%p\\n&#8217; 2&gt;\/dev\/null | sort -nr | awk -F&#8217;|&#8217; &#8216;{ cmd=&#8221;date -d @&#8221;$1&#8243; \\&#8221;+%Y-%m-%d %H:%M:%S\\&#8221;&#8221;; cmd | getline time; close(cmd); print time, $2 }&#8217; \u5c06 \/your\/path \u66ff\u6362\u4e3a\u4f60\u8981\u68c0\u67e5\u7684\u76ee\u5f55\u8def\u5f84\uff08\u5982 \/home\u3001\/var\/log \u7b49\uff09\u3002 \ud83d\udccc \u8f93\u51fa\u793a\u4f8b\uff1a &hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[200],"tags":[],"class_list":["post-4814","post","type-post","status-publish","format-standard","hentry","category-s813p67hzr2cjjx"],"_links":{"self":[{"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/posts\/4814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/comments?post=4814"}],"version-history":[{"count":1,"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/posts\/4814\/revisions"}],"predecessor-version":[{"id":4815,"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/posts\/4814\/revisions\/4815"}],"wp:attachment":[{"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/media?parent=4814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/categories?post=4814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eternalsphere.net\/echoes\/index.php\/wp-json\/wp\/v2\/tags?post=4814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}