[英]How do I display a tree of things in Bash?
How do I make a tree of all things with bash? 如何用bash制作所有东西的树? What is the command?
命令是什么?
tree /
or 要么
find /
Update: @OP, since you have so much trouble with it, how about this alternative. 更新:@OP,因为你有这么多麻烦,这个替代方案怎么样。 On ubuntu 9.10, you should have bash 4.0 ?
在ubuntu 9.10上,你应该有bash 4.0吗? so try this
试试吧
#!/bin/bash
shopt -s globstar
for rdir in /*/
do
for file in $rdir/**
do
echo "$file"
done
done
$ find . -print | sed -e 's;/*/;|;g;s;|; |;g'
在〜/ .bash_profile中添加别名
alias tree="find . -print | sed -e 's;/*/;|;g;s;|; |;g'"
you should probably alias this :) 你应该别名这个:)
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\\/]*\\//--/g' -e 's/^/ /' -e 's/-/|/'
(Warning: huge output) (警告:巨大输出)
tree -R /
and then cry because it's enormous. 然后哭,因为它是巨大的。
On a related note, to stop the command, press CTRL + C 在相关说明中,要停止该命令,请按CTRL + C.
Assuming you want to find something from tree, do 假设你想从树上找到一些东西,那就去做吧
tree / > tree.txt
Then Ctrl + F it. 然后按Ctrl + F它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.