Nature has its own way to reach out for perfection and the same should be our instinct to make our creations perfect.
Scenario-1:Consider an ideal software or package which requires multiple files to function properly.
- Binary files
- Configuration files
- Log files
- Data files
- Metadata files during execution
Another software comes in the picture which has its own dependent files.
Things will get messy while dealing with various software since handling them won't be easy and will lead to a chaotic situation.
- Binary files --> /dir-1
- Configuration files --> /dir-2
- Log files --> /dir-3
- Data files --> /dir-4
- Meta files --> /dir-5
- Libraries --> /dir-6
To escape this situation the creator of Unix decided to follow a philosophy "Convention over Configuration".
As the name suggest giving priority to defined convention over individual's configuration. So that everyone should be on the same page and keeping that in mind everyone else will follow.
And the simulation of the philosophy was like this
- Binary files --> /bin
- Configuration files --> /etc
- Log files --> /log
- Data files --> /var
- Meta files --> /tmp
- Libraries --> /lib
You might be thinking that how will Unix figure out where is the configuration file, where is the binary and rest of the stuff of the software.
Here comes the role of the PATH variable
These are environment variables specifying a set of directories where executable programs are located. In general, each executing process or user session has its own PATH setting.
So now we have a proper understanding of why do we need a File Tree.
For diving deep into the significance of each one of the directory stay tuned for Unix File Tree Part-2.
Image Source: https://freestocks.org/fs/wp-content/uploads/2016/04/tree_trunk.jpg