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.