CentOS目录结构是树形的吗?
CentOS 上有相当于树的东西吗?
Is there an equivalent to tree on CentOS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
CentOS 上有相当于树的东西吗?
Is there an equivalent to tree on CentOS?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
如果你的 Centos 系统上没有安装 tree(我通常建议服务器设置无论如何都使用最小安装磁盘),你应该在命令行中键入以下内容:
如果没有安装,那是因为你没有正确的存储库。我将使用 Dag Wieers 存储库:
http://dag.wieers.com/rpm/FAQ.php#B< /a>
之后您就可以进行安装了:
现在您就可以开始了。始终阅读手册页: http://linux.die.net/man/1/tree
非常简单以下将返回一棵树:
或者您可以将其输出到文本文件。还有很多选项。再次,如果您正在寻找默认输出以外的内容,请阅读您的手册页。
(^^ 在文本文件中供以后查看^^)
If tree is not installed on your Centos system (I typically recommend server setups to use minimal install disk anyhow) you should type the following at your command line:
If this doesn't install it's because you don't have the proper repository. I would use the Dag Wieers repository:
http://dag.wieers.com/rpm/FAQ.php#B
After that you can do your install:
Now you're ready to roll. Always read the man page: http://linux.die.net/man/1/tree
So quite simply the following will return a tree:
Alternatively you can output this to a text file. There's a ton of options too.. Again, read your man page if you're looking for something other than default output.
(^^ in a text file for later review ^^)
你可以制作自己的原始“树”(为了好玩:))
You can make your own primitive "tree" ( for fun :) )
由于 CentOS 中默认情况下未安装
tree
...您还可以使用以下
ls
命令生成与tree
示例几乎相似的输出:
Since
tree
is not installed by default in CentOS ...You can also use the following
ls
command to produce almost similar output withtree
Example:
正如您在此处看到的那样。 CentOs 中默认未安装 tree,因此您需要查找 RPM 并手动安装它
As you can see here. tree is not installed by default in CentOs, so you'll need to look for an RPM and install it manually
您在基础存储库中有树。
显示它 (yum list package-name):
安装它:
(在 CentOS 5 和 6 上验证)
You have tree in the base repo.
Show it (yum list package-name):
Install it:
(verified on CentOS 5 and 6)
我需要在不允许我进行
yum
安装的远程计算机上工作。所以我修改了 bash-o-logger 的答案以获得更灵活的答案。它需要一个(可选)参数,该参数是您要显示的子目录的最大级别。将其添加到您的
$PATH
中,即可享受无需安装的tree
命令。我不是 shell 专家(为了这个非常短的脚本,我不得不用 Google 搜索很多次)。所以如果我做错了什么,请告诉我。太感谢了!
I need to work on a remote computer that won't allow me to
yum
install. So I modified bash-o-logist's answer to get a more flexible one.It takes an (optional) argument that is the maximum level of subdirectories you want to show. Add it to your
$PATH
, and enjoy atree
command that doesn't need installation.I am not an expert in shell (I had to Google a ton of times just for this very short script). So if I did anything wrong, please let me know. Thank you so much!