You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
4.2 KiB

10 years ago
---
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'
---
<p>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.</p>
<p>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 <em>file</em> 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.</p>
<table border="0" cellspacing="1" cellpadding="1" width="500">
<tbody style="background:#fff6e1;font-size: 0.95em" id="spec">
<tr>
<td valign="top" width="121">/</td>
<td valign="top">Every tree needs root, file structure is also the same.</td>
</tr>
<tr class="odd">
<td valign="top" width="121">/boot</td>
<td valign="top">This is for boot loader files, e.g. GRUB, KERNEL, SYSTEM.MAP, VMLINUZ, INITRD, …</td>
</tr>
<tr>
<td valign="top">/bin</td>
<td valign="top">bin == binary; it contains commands stuff and /bin is for essential ones only.</td>
</tr>
<tr class="odd">
<td valign="top" width="121">/etc</td>
<td valign="top">This is for any system configuration; if you ever need to adjust things, this is likely to be the place to go.</td>
</tr>
<tr>
<td valign="top">/sbin</td>
<td valign="top">it doesn’t differ to /bin that much, but it contains system utilities that don’t need that much speed.</td>
</tr>
<tr class="odd">
<td valign="top" width="121">/home</td>
<td valign="top">This is the same as c:\users in Windows’ sense. Just contain any thing of each user in /home/&lt;usr&gt; commonly.</td>
</tr>
<tr>
<td valign="top">/usr</td>
<td valign="top">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.</td>
</tr>
<tr class="odd">
<td valign="top" width="121">/usr/bin <br /><em>vs</em> /usr/local/bin</td>
<td valign="top">The difference is /usr/bin stored user commands while /usr/local/bin stored local software</td>
</tr>
<tr>
<td valign="top">/opt</td>
<td valign="top">That’s for application software, such as Thunderbird and such.</td>
</tr>
<tr class="odd">
<td valign="top" width="121">/root</td>
<td valign="top">This is home for root =)</td>
</tr>
<tr>
<td valign="top">/tmp</td>
<td valign="top">tmp == temporary; it uses as its name.</td>
</tr>
<tr class="odd">
<td valign="top" width="121">/var</td>
<td valign="top">var == variable. It uses to store configuration, logging and application information</td>
</tr>
<tr class="odd">
<td valign="top" width="121">/mnt</td>
<td valign="top">mnt == mount point; some distros use this, some don’t, some even use /Windows or /media instead of this</td>
</tr>
</tbody>
</table>
<p style="font-size: 0.9em"><em><u>note</u></em>: 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.</p>
<p>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.</p>