I have just finished migrating my website to the Amazon EC2 cloud and by doing so had to dive into an unfamiliar operating system.
Previously, I hosted all my content on a FreeBSD server which I have used for about 6 years. Even though I was operating several websites and development environments on it, I didn’t truly understand it. I mainly followed online tutorials and did what I was told to do in the FreeBSD documentation.
The FreeBSD ami is not truly supported by Amazon so rather than risk the hassle I decided to choose one of the supported ami’s. I picked Ubuntu 12.04 Precise Pangolin. Why Ubuntu? It’s popular, I have used it slightly before, and it was high up on the ami list. Only now when I was configuring this foreign operating system did I try to understand it.
The Unix architecture, unlike Windows, is simply a hierarchy of files and folders. At first glance it appears to be an archaic structure, but once you understand it – it just makes sense.
The directory structure is defined as follows:
- / – root, the root of the unix file system.
- /bin – “binaries”. Contains the fundamental applications and utilities required by all users.
- /sbin – “superuser/system binaries”. Contains fundamental applications and utilities used by the system.
- /etc – Not to be confused with et cetera and pronounced “et-see”. This folder contains all of the system configuration files and databases. Looking for your nginx or apache config files? They are probably in here. /etc/rc.d contains shell scripts that run on system startup.
- /dev – “devices” Contains file representations of any peripheral devices connected to the machine.
- /boot – Files that the system needs to boot.
- /home – The home directory for all the users. The user “kyle” would have their home directory in /home/kyle.
- /lib – “Libraries” Contains system libraries, drivers, and modules.
- /root – The home directory for the super user.
- /tmp – “Temporary files”
- /usr – “User” This directory contains binaries, libraries, configuration files that are not system critical. I like to think of the usr folder similar C:Program Files. Anything you install as a user like vi, Skype or Gimp should end up somewhere in here.
- /var/ – “Variable” Mainly contains log files and databases.