转自: http://xnlinux.haotui.com/thread-1669-1-1.html
gao@gao-virtual-machine:~/test$ tree . |-- test1 | |-- test11 | | |-- test111 | | |-- test112 | | `-- test113 | |-- test12 | `-- test13 |-- test2 | |-- test21 | |-- test22 | `-- test23 `-- test3 |-- test31 |-- test32 `-- test33 下面是find . -print|sed -e 's;[^/]*/;|--;g;s;--|; |;g' 命令出来的结果: gao@gao-virtual-machine:~/test$ find . -print|sed -e 's;[^/]*/;|--;g;s;--|; |;g' . |--test3 | |--test31 | |--test33 | |--test32 |--test1 | |--test11 | | |--test111 | | |--test113 | | |--test112 | |--test12 | |--test13 |--test2 | |--test23 | |--test21 | |--test22 使用find即可实现tree的功能了,特别是在没有tree命令的系统里。。 |