Implementation of tree commands similar to dos in Solaris

Source: Internet
Author: User

The original article was written on the Netease blog at 20:48:07 and has been deleted

Today, for work reasons, I need to know the directory structure of a software installation under Solaris. I thought of the Tree Command. Unfortunately, there is no tree command under DOS under Solaris.

After searching for the Internet, I found that some people, like me, need to use the Tree Command similar to dos in some occasions. These two commands were found in a forum:

1. Find the target directory-type D-print

2. Target du directory

The first command is to find the file type of directory in the target directory and print it out.

The second command is to check the disk usage in the target directory. however, the output is the number of bytes in the directory size in the capital of each row. it looks uncomfortable. so I used the du target directory | awk '{print $2}' to remove the first byte column from the row and not display it in the output content.

Finally, the execution results of the two commands are reversed. find prints the results from the directory entry, prints them down, prints them to the bottom directory, and traces them back to the previous directory. du prints the bottom-layer directory first, then traces back to the top-level directory, and then prints.

Supplement:
The use of awk. Previously there was a special book on the internet, awk and sed. You can refer to this book.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.