---
title: "使用一行命令实现tree功能"
author: "harry"
date: "2009-08-18T11:41:04Z"
tags: []
slug: "tree"
draft: false
lastmod: "2009-08-18T11:41:04Z"
id: 451917
url: "https://harry.iteye.com/blog/451917"
---

使用ls, grep, and sed实现tree命令功能，如下：

```
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'
```