--- layout: post status: publish published: true title: 'Linux 101: file structure/hierarchy' author: display_name: '' login: '' email: '' url: '' wordpress_id: 558 wordpress_url: http://blog.10ninox.com/2009/04/02/linux-101-file-structurehierarchy/ date: '2009-04-02 04:05:11 +0700' date_gmt: '2009-04-02 09:05:11 +0700' categories: - linux tags: - '101' ---

File structure is the basic things people get confuse when start using Linux. Most people nowadays are likely to stick with Windows’ idea, e.g.C:\Windows\ or C:\Program files\ or C:\Users\xxxx. That’s pretty easy to understand. *nix file structure was confusing at first, but it’s not that hard to understand. In order to learn using it, then you have to know where things are first.

In *nix system, everything is a file. Whatever they are, they are represented in file format. There is no extension to distinguish any type of file, but utility called file can identify it. directory is also one kind of file. Process is also represented in file. We’ll talk about ‘file’ in detail later. Ok, I got to start with what each of directory in *nix is for.

/ Every tree needs root, file structure is also the same.
/boot This is for boot loader files, e.g. GRUB, KERNEL, SYSTEM.MAP, VMLINUZ, INITRD, …
/bin bin == binary; it contains commands stuff and /bin is for essential ones only.
/etc This is for any system configuration; if you ever need to adjust things, this is likely to be the place to go.
/sbin it doesn’t differ to /bin that much, but it contains system utilities that don’t need that much speed.
/home This is the same as c:\users in Windows’ sense. Just contain any thing of each user in /home/<usr> commonly.
/usr This is not where users store file, but it has hierarchy like / too. /usr/bin, /usr/lib, /usr/local/share, /usr/share, for example. What difference between /usr/bin and /bin is /bin usually contains kernel command while /usr/bin contains user commands that are not related to kernel/OS At first, /bin was designed to use in different disk (faster one) and the rest will be in /usr/bin or /usr/local/bin.
/usr/bin
vs /usr/local/bin
The difference is /usr/bin stored user commands while /usr/local/bin stored local software
/opt That’s for application software, such as Thunderbird and such.
/root This is home for root =)
/tmp tmp == temporary; it uses as its name.
/var var == variable. It uses to store configuration, logging and application information
/mnt mnt == mount point; some distros use this, some don’t, some even use /Windows or /media instead of this

note: basically each of these will be in different partition/disk as well, so there is another factor involved, speed. That’s why it has commands in all over the place. Some utilities are just more important than others.

Above matrix should cover basic filesystem structure. As usual, different distribution might have a bit of different point of view, but they all share the same idea =) After knowing each of these files are for, then you will know where to expect particular files or things you need. Have fun with *nix experience.