﻿{"id":22252,"date":"2023-07-23T20:51:10","date_gmt":"2023-07-23T12:51:10","guid":{"rendered":"https:\/\/www.linuxmi.com\/?p=22252"},"modified":"2023-07-23T20:51:10","modified_gmt":"2023-07-23T12:51:10","slug":"dutree","status":"publish","type":"post","link":"https:\/\/www.linuxmi.com\/dutree.html","title":{"rendered":"dutree\uff1a\u5f3a\u5927\u7684 Linux \u6587\u4ef6\u7cfb\u7edf\u78c1\u76d8\u4f7f\u7528\u8ffd\u8e2a\u5de5\u5177"},"content":{"rendered":"<p>dutree \u662f\u4e00\u4e2a\u514d\u8d39\u3001\u5f00\u6e90\u3001\u5feb\u901f\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u5206\u6790\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u3002\u5b83\u662f\u7528 Rust \u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u7684\uff0c\u5e76\u7ed3\u5408\u4e86 durep\uff08\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u62a5\u544a\u5de5\u5177\uff09\u548c tree\uff08\u4ee5\u6811\u5f62\u683c\u5f0f\u5217\u51fa\u76ee\u5f55\u5185\u5bb9\uff09\u547d\u4ee4\u884c\u5de5\u5177\u7684\u529f\u80fd\u3002\u56e0\u6b64\uff0cdutree \u4ee5\u6811\u5f62\u683c\u5f0f\u62a5\u544a\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n<p>dutree\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u8ddf\u8e2a\u5de5\u5177\uff0c\u9002\u7528\u4e8eLinux\u6587\u4ef6\u7cfb\u7edf\u3002\u5b83\u662f\u4e00\u4e2a\u514d\u8d39\u4e14\u5f00\u6e90\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528Rust\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\uff0c\u7ed3\u5408\u4e86durep\uff08\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u62a5\u544a\u5de5\u5177\uff09\u548ctree\uff08\u4ee5\u6811\u5f62\u683c\u5f0f\u5217\u51fa\u76ee\u5f55\u5185\u5bb9\uff09\u547d\u4ee4\u884c\u5de5\u5177\u7684\u529f\u80fd\uff0c\u4ee5\u6811\u5f62\u683c\u5f0f\u5c55\u793a\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n<p>dutree\u663e\u793a\u5e26\u6709\u989c\u8272\u7684\u8f93\u51fa\uff0c\u53d6\u51b3\u4e8eGNU LS_COLORS\u73af\u5883\u53d8\u91cf\u4e2d\u914d\u7f6e\u7684\u503c\u3002\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u5141\u8bb8\u6839\u636e\u6587\u4ef6\u7684\u6269\u5c55\u540d\u3001\u6743\u9650\u548c\u6587\u4ef6\u7c7b\u578b\u8bbe\u7f6e\u6587\u4ef6\u7684\u989c\u8272\u3002<\/p>\n<p>dutree\u7684\u7279\u70b9\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u663e\u793a\u6587\u4ef6\u7cfb\u7edf\u6811\u7ed3\u6784\u3002<\/li>\n<li>\u652f\u6301\u5408\u5e76\u5c0f\u6587\u4ef6\u3002<\/li>\n<li>\u5141\u8bb8\u6bd4\u8f83\u4e0d\u540c\u76ee\u5f55\u3002<\/li>\n<li>\u652f\u6301\u6392\u9664\u6587\u4ef6\u6216\u76ee\u5f55\u3002<\/li>\n<\/ul>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\u5b89\u88c5dutree\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u7cfb\u7edf\u5df2\u7ecf\u5b89\u88c5\u4e86Rust\u7f16\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u8fd8\u6ca1\u6709\u5b89\u88c5Rust\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0bcurl\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % sudo curl https:\/\/sh.rustup.rs -sSf | sh<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22253\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/rust1.png\" alt=\"\" width=\"1042\" height=\"566\" \/><\/p>\n<p>\u5b89\u88c5\u5b8c Rust \u540e\uff0c\u4f60\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5728Linux\u53d1\u884c\u7248\u4e2d\u5b89\u88c5 dutree\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % cargo install --git https:\/\/github.com\/nachoparker\/dutree.git<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22254\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut1.png\" alt=\"\" width=\"1042\" height=\"566\" \/><\/p>\n<p>\u5b89\u88c5\u5b8c dutree \u540e\uff0c\u5b83\u5c06\u6839\u636e\u73af\u5883\u53d8\u91cf LS_COLORS \u4f7f\u7528\u73af\u5883\u989c\u8272\uff0c\u4e0e\u6211\u4eec\u7684\u53d1\u884c\u7248\u914d\u7f6e\u7684 ls &#8211;color \u547d\u4ee4\u5177\u6709\u76f8\u540c\u7684\u989c\u8272\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % ls --color<\/code><\/pre>\n<p>\u8fd0\u884c dutree \u6700\u7b80\u5355\u7684\u65b9\u5f0f\u662f\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\uff0c\u8fd9\u6837\u5b83\u4f1a\u663e\u793a\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf\u6811\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22255\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dutree.png\" alt=\"\" width=\"1042\" height=\"566\" \/><\/p>\n<p>\u8981\u663e\u793a\u5b9e\u9645\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u800c\u4e0d\u662f\u6587\u4ef6\u5927\u5c0f\uff0c\u8bf7\u4f7f\u7528 -u \u6807\u5fd7\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -u<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22256\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut2.png\" alt=\"\" width=\"1042\" height=\"566\" \/><\/p>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528-d\u6807\u5fd7\u663e\u793a\u7ed9\u5b9a\u6df1\u5ea6\uff08\u9ed8\u8ba4\u4e3a1\uff09\u7684\u76ee\u5f55\u3002\u4e0b\u9762\u7684\u547d\u4ee4\u5c06\u663e\u793a\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u4e0b\u6df1\u5ea6\u4e3a3\u7684\u76ee\u5f55\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5982\u679c\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff08~\/\uff09\uff0c\u5219\u663e\u793a ~\/*\/*\/* \u7684\u5927\u5c0f\uff0c\u5982\u4ee5\u4e0b\u793a\u4f8b\u5c4f\u5e55\u622a\u56fe\u6240\u793a\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -d 3<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-22259\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut5.png\" alt=\"\" width=\"1042\" height=\"659\" \/><\/p>\n<p>\u5728\u8f93\u51fa\u4e2d\u6392\u9664\u6587\u4ef6\u6216\u76ee\u5f55<\/p>\n<p>\u8981\u6392\u9664\u4e0e\u6587\u4ef6\u540d\u6216\u76ee\u5f55\u540d\u5339\u914d\u7684\u9879\uff0c\u8bf7\u4f7f\u7528 -x \u6807\u5fd7\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -x alpine-extended-3.16.1-x86_64.iso<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22258\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut6.png\" alt=\"\" width=\"1042\" height=\"628\" \/><\/p>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 -f \u9009\u9879\u6765\u8df3\u8fc7\u76ee\u5f55\uff0c\u4ece\u800c\u5feb\u901f\u83b7\u53d6\u672c\u5730\u6982\u89c8\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -f<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22260\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut7.png\" alt=\"\" width=\"1042\" height=\"504\" \/><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528 -s \u6807\u5fd7\u751f\u6210\u5b8c\u6574\u7684\u6982\u8981\/\u603b\u89c8\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -s<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22261\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut8.png\" alt=\"\" width=\"1042\" height=\"504\" \/><\/p>\n<p>\u53ef\u4ee5\u805a\u5408\u5c0f\u4e8e\u67d0\u4e2a\u7279\u5b9a\u5927\u5c0f\u7684\u6587\u4ef6\uff0c\u7f3a\u7701\u503c\u4e3a1M\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -a<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22262\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut9.png\" alt=\"\" width=\"1042\" height=\"504\" \/><\/p>\n<p>\u6392\u9664\u9690\u85cf\u6587\u4ef6\u7684\u5f00\u5173\u662f-H\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -H<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-22264\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut21.png\" alt=\"\" width=\"1042\" height=\"659\" \/><\/p>\n<p>\u8be5\u9009\u9879\u7528\u4e8e\u4ee5\u5b57\u8282\u800c\u4e0d\u662f\u5343\u5b57\u8282\uff08\u7f3a\u7701\uff09\u7684\u65b9\u5f0f\u663e\u793a\u5927\u5c0f\u3002-b<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -b\r\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22263\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut22.png\" alt=\"\" width=\"1042\" height=\"659\" \/><\/p>\n<p>\u8981\u5173\u95ed\u989c\u8272\uff0c\u4ec5\u663e\u793a ASCII \u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528\u6807\u5fd7 -A\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi ~\/www.linuxmi.com\r\n % dutree -A<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22265\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2023\/07\/dut23.png\" alt=\"\" width=\"1042\" height=\"659\" \/><\/p>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528 -h \u9009\u9879\u67e5\u770b dutree \u5e2e\u52a9\u6d88\u606f\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">$ dutree -h<\/code><\/pre>\n<p>\u4f7f\u7528\u65b9\u5f0f: dutree [\u9009\u9879] [..]<\/p>\n<p>\u9009\u9879:<br \/>\n-d, &#8211;depth [DEPTH] \u663e\u793a\u76ee\u5f55\u6df1\u5ea6\u4e3a N (\u9ed8\u8ba4 1)<br \/>\n-a, &#8211;aggr [N[KMG]] \u805a\u5408\u5c0f\u4e8e N B\/KiB\/MiB\/GiB \u7684\u6587\u4ef6\uff08\u9ed8\u8ba4 1M\uff09<br \/>\n-s, &#8211;summary \u7b49\u6548\u4e8e -da\uff0c\u6216 -d1 -a1M<br \/>\n-u, &#8211;usage \u62a5\u544a\u5b9e\u9645\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u800c\u4e0d\u662f\u6587\u4ef6\u5927\u5c0f<br \/>\n-b, &#8211;bytes \u4ee5\u5b57\u8282\u6253\u5370\u5927\u5c0f<br \/>\n-x, &#8211;exclude NAME \u6392\u9664\u5339\u914d\u7684\u6587\u4ef6\u6216\u76ee\u5f55<br \/>\n-H, &#8211;no-hidden \u6392\u9664\u9690\u85cf\u6587\u4ef6<br \/>\n-A, &#8211;ascii \u4ec5\u4f7f\u7528 ASCII \u5b57\u7b26\uff0c\u4e0d\u4f7f\u7528\u989c\u8272<br \/>\n-h, &#8211;help \u663e\u793a\u5e2e\u52a9<br \/>\n-v, &#8211;version \u6253\u5370\u7248\u672c\u53f7<\/p>\n<p>dutree \u662f\u4e00\u4e2a\u7b80\u5355\u800c\u5f3a\u5927\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u5728 Linux \u7cfb\u7edf\u4e0a\u4ee5\u6811\u72b6\u683c\u5f0f\u663e\u793a\u6587\u4ef6\u5927\u5c0f\u548c\u5206\u6790\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u3002\u5982\u679c\u8fd8\u6709\u4ec0\u4e48\u7591\u95ee\u4e0e\u5efa\u8bae\uff0c\u8bf7\u5728\u4e0b\u9762\u7684\u8bc4\u8bba\u680f\u4e2d\u7559\u8a00\u544a\u8bc9\u6211\u4eec\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>dutree \u662f\u4e00\u4e2a\u514d\u8d39\u3001\u5f00\u6e90\u3001\u5feb\u901f\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u5206\u6790\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\u3002\u5b83\u662f\u7528 Rust \u7f16\u7a0b\u8bed\u8a00\u7f16 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[1380],"class_list":["post-22252","post","type-post","status-publish","format-standard","hentry","category-linux","tag-dutree"],"aioseo_notices":[],"views":449,"_links":{"self":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/22252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/comments?post=22252"}],"version-history":[{"count":1,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/22252\/revisions"}],"predecessor-version":[{"id":22266,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/22252\/revisions\/22266"}],"wp:attachment":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/media?parent=22252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/categories?post=22252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/tags?post=22252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}