Linux Directories

The UNIX directory is laid out as a giant hierarchy of files, like a tree. In UNIX, everything is a sort of file to be manipulated, even what many users would consider “folders”. In UNIX, a folder is a “directory”. The UNIX tree starts at “root”, or “/”, then spreads out through different paths. A path is the full address of where a file is.

There is a tool called “mount” which allows you to attach directory paths from either an external device (e.g. a removable flashdrive) or attach an existing directory from a different part of the tree. Autofs is a scripting tool that runs an automount command. What this does is if you attempt to go to directory that hasn’t been mounted yet, if the configuration on autofs states that there should be one, then it will mount the separate directory to your tree.

For example, let’s you would like access to the files in the ACM stash (/stash/acm). You want to investigate it and its files, but you can’t seem to find it. You go and run the commands:

> cd /stash
> ls
> ls -a

But, the directory isn’t displayed. This doesn’t mean it’s hidden, or that you don’t have permission to view it. The reason for this is that the directory hasn’t been mounted yet on your profile. If you know that the directory “acm” is located in “/stash”, then simply:

> cd acm

If autofs is configured to automount “acm” there, then it will do so. Now you have the directory “acm” mounted. If you navigated up one directory (/stash) and ran “ls” again, you would see that “acm” is now mounted and is being displayed as a normal directory within your hierarchy tree on UNIX at the path /stash/acm. Autofs works this way with any stash, and you will be able to interact with the stash as per your file permissions.