Skip to main content

tag: sed

Categories
Code SamplesShell

One Line Linux Command to Print Out Directory Tree Listing

My professor sent us this little one liner (ok, I had to format it to 2 lines to fit in this blog. You know what I mean) which prints out the current directory tree: ls -R | grep “:$” | sed -e ‘s/:$//’ -e ‘s/[^-][^\/]*\//–/g’ \ -e ‘s/^/ /’ -e ‘s/-/|/’ What’s going on here?