in Computing by

1 Answer

0 like 0 dislike
Best answer

The tree command lists the directory structure (or the part of it for which the current user is allowed to access) below the directory where it’s given. If the command is given in the main directory ( C:\ , D:\ etc.), it shows the dirctory structure on the disk (or more precisely the part of it which the current user is allowed to see). That was the purpose it was made for; before graphical user interfaces that was pretty much the only way to see more of the directory structure than just the directorys right under the current one. If you wouldn’t remember exactly where a certain directory you were looking for was, you would list the directories to refresh your memory with tree. That’s the intended purpose of the command.

As a side effect, the fact that a lot of the table of contents on the disk has been recently read, can speed up a computer with a mechanical harddrive. Stuff that’s been recently read from the disk is kept for a while in memory, in case it would be needed again, to minimize the workload of the potentially slow harddrive. This is called disk caching, and with a relatively modern computer with a gigabyte or few of RAM, the part of memory that’s used for caching can be large enough, and so parts of the table of contents that was read can remain in the memory for a while. While it’s in the memory, normal computer use can be somewhat faster, because it often involves reading parts of several files in a sequence, and normally the system would have to go find each file in the table of contents, and then go to actually read the file, then find the next file etc. But with disk caching, and a large part of the table of contents being cached, there’s less work for the mechanical disk, which often is the bottleneck on a modern system.

© Pauli Vaara

626 questions
612 answers
3 users