# The Unix Tree

The UNIX file system consists of files and directories organized in a hierarchical structure. When visualized, this hierarchical structure looks like a tree, with roots and many branches.

`tree -L 1 /` *command, showing the Unix filesystem tree:*

<pre class="language-bash"><code class="lang-bash">/
├── bin
├── boot
├── dev
├── etc
├── home
├── lib
├── lib64
├── mnt
├── nfs
├── opt
├── proc
├── root
├── run
├── srv
├── sys
├── tmp
├── usr
└── var
<strong>
</strong>19 directories, 0 files
</code></pre>

Every file or directory in a UNIX operating system is somewhere on this "tree." `/` is referred to as "root," because it's the root of the tree which every other file or directory is inside.

For example, every UNIX user's home directory is in `home`, which is in `/`. In other words, every user's home directory is in `/home`.

Unix has some shortcuts for referring to directories.

* `.` stands for "my current directory."
* `..` stands for "my parent directory," a.k.a. the directory one branch higher in the tree
* `~` stands for "my home directory."

*Example of Unix directory shortcuts:*

```bash
/
├── home
│   ├── asoberan ( ~ )
│   │   └──Documents ( .. )
│   │      └──unix_class (I am here) ( . )
│   ├── duan
│   └── yourusername
├── etc
├── bin
├── tmp
...
```

The organization of the filesystem is not set in stone. However, there is a standard that many UNIX operating systems follow called the Filesystem Hierarchy Standard (FHS). The FHS defines a standard filesystem layout for greater uniformity and easier documentation across UNIX-like operating systems.

Some of what the FHS dictates includes:

* `/` must have everything to boot, restore, recover, or repair a system.
* `/etc` holds configuration files for the system and programs present on the system. For example, if I install the SSH server, I can reasonably expect configuration files for it to be found at `/etc/ssh/`
* `/home` are user's home directories
* `/tmp` holds temporary files that can be deleted on reboot
* `/bin` holds essential programs that are needed for system recovery
* `/usr/bin` holds non-essential programs

Thanks to the FHS, you can expect most UNIX-like operating systems to look like this.
