个人工具

“UbuntuHelp:LinuxFilesystemTreeOverview”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/LinuxFilesystemTreeOverview}} {{Languages|UbuntuHelp:LinuxFilesystemTreeOverview}} "Linux systems organized files in a hierarchical filesystem tre...)
 
 
(未显示同一用户的5个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/LinuxFilesystemTreeOverview}}
 
{{From|https://help.ubuntu.com/community/LinuxFilesystemTreeOverview}}
 
{{Languages|UbuntuHelp:LinuxFilesystemTreeOverview}}
 
{{Languages|UbuntuHelp:LinuxFilesystemTreeOverview}}
"Linux systems organized files in a hierarchical filesystem tree, relationships are thought of in teams of children and parent. Here, a parent may have multiple children, but a child can only have one parent. In Ubuntu, root filesystem (/) become a parent, and then travel down into directories and subdirectories, so matter how many directories do you have, they only always have one parent (/)."
+
Ubuntu (like all UNIX-like systems) organizes files in a hierarchical tree, where relationships are thought of in teams of children and parent. ''Directories'' can contain other directories as well as ''regular files'', which are the "leaves" of the tree.
 
+
Any element of the tree can be references by a ''path name''; an ''absolute path name'' starts with the character <code><nowiki>/</nowiki></code> (identifying the ''root directory'', which contains all other directories and files), then every child directory that must be traversed to reach the element is listed, each separated by a <code><nowiki>/</nowiki></code> sign.
=== Ubuntu GNU/Linux Filesystem Tree Overview ===
+
A ''relative path name'' is one that doesn't start with <code><nowiki>/</nowiki></code>; in that case, the directory tree is traversed starting from a given point, which changes depending on context, called the ''current directory''. In every directory, there are two special directories called <code><nowiki>.</nowiki></code> and <code><nowiki>..</nowiki></code>, which refer respectively to the directory itself, and to its parent directory.
 +
The fact that all files and directories have a common root means that, even if several different storage devices are present on the system, they are all seen as directories somewhere in the tree, once they are [[UbuntuHelp:Mount|mounted]] to the desired place.
 +
[[UbuntuHelp:FilePermissions|FilePermissions]] are another important part of the files organization system: they are superimposed to the directory structure and assign ''permissions'' to each element of the tree, ultimately decided by whom it can be accessed and how.
 +
=== Examples ===
 +
An absolute path name, pointing to what is normally an executable file on an Ubuntu system:
 
<pre><nowiki>
 
<pre><nowiki>
 
+
/usr/bin/test
-/
+
|--/bin
+
|--/boot
+
|--/cdrom
+
|--/dev
+
|--/etc
+
|--/initrd
+
|--/home
+
|  |--/home/sweet
+
|  |--/home/user
+
|--/lib
+
|--/lost+found
+
|--/media
+
|  |--/media/cdrom
+
|  |--/media/hda*
+
|--/mnt
+
|--/opt
+
|--/proc
+
|--/root
+
|--/sbin
+
|--/srv
+
|  |--/srv/www
+
|--/sys
+
|--/tmp
+
|--/usr
+
|  |--/usr/bin
+
|  |--/usr/doc
+
|  |--/usr/games
+
|  |--/usr/include
+
|  |--/usr/info
+
|  |--/usr/lib
+
|  |--/usr/local
+
|  |--/usr/sbin
+
|  |--/usr/share
+
|  |--/usr/src
+
|  |--/usr/X11R6
+
|--/var
+
|--/var/log
+
 
+
 
</nowiki></pre>
 
</nowiki></pre>
 
+
An absolute path name, but pointing to a directory instead of a regular file:
=== What's in a Name? ===
+
<pre><nowiki>
 
+
/usr/bin/
 +
</nowiki></pre>
 +
A relative path name, which will point to <code><nowiki>/usr/bin/test</nowiki></code> only if the current directory is <code><nowiki>/usr/</nowiki></code>:
 +
<pre><nowiki>
 +
bin/test
 +
</nowiki></pre>
 +
A relative path name, which will point to <code><nowiki>/usr/bin/test</nowiki></code> if the current directory is any directory in <code><nowiki>/usr/</nowiki></code>, for instance <code><nowiki>/usr/share/</nowiki></code>:
 +
<pre><nowiki>
 +
../bin/test
 +
</nowiki></pre>
 +
A path name using the special shortcut <code><nowiki>~</nowiki></code>, which refers to the current user's ''home'' directory:
 +
<pre><nowiki>
 +
~/Desktop/
 +
</nowiki></pre>
 +
Path names can contain almost any character, but some characters, such as '''space''', must be ''escaped'' in most software, usually by enclosing the name in quotation marks:
 +
<pre><nowiki>
 +
"~/Examples/Experience ubuntu.ogg"
 +
</nowiki></pre>
 +
or by employing the escape character <code><nowiki>\</nowiki></code>:
 +
<pre><nowiki>
 +
~/Examples/Experience\ ubuntu.ogg
 +
</nowiki></pre>
 +
=== Main directories ===
 +
The standard Ubuntu directory structure mostly follows the [http://www.pathname.com/fhs Filesystem Hierarchy Standard], which can be referred to for more detailed information.
 +
Here, only the most important directories in the system will be presented.
 
'''/bin'''
 
'''/bin'''
Is a place for most common use Linux program, like ls, mount, rm, and chmod.
+
is a place for most commonly used [[UbuntuHelp:UsingTheTerminal|terminal]] commands, like <code><nowiki>ls</nowiki></code>, <code><nowiki>mount</nowiki></code>, <code><nowiki>rm</nowiki></code>, etc.
 
+
 
'''/boot'''
 
'''/boot'''
Store Linux kernel, a ramdisk image and bootloader configuration files (Lilo or Grub).
+
contains files needed to start up the system, including the [[UbuntuHelp:Kernel|Linux kernel]], a RAM disk image and [[UbuntuHelp:GrubHowTo|bootloader]] configuration files.
 
+
 
'''/dev'''
 
'''/dev'''
For device files, these include hard disk(''/dev/hda*''), RAM(''/dev/ram''), CD-ROM(''dev/cdrom'') and terminal devices(''/dev/tty'').
+
contains all ''device files'', which are not regular files but instead refer to various hardware devices on the system, including hard drives.
 
+
 
'''/etc'''
 
'''/etc'''
Contains configuration files for administration task. Some of files, such as passwd file, apache config, network config store in ''/etc''.
+
contains system-global configuration files, which affect the system's behavior for all users.
 
+
 
'''/home'''
 
'''/home'''
Home sweet home, place for users' home directories.
+
home sweet home, this is the place for users' home directories.
 
+
 
'''/lib'''
 
'''/lib'''
Contains very important dynamic libraries and place for kernel modules
+
contains very important dynamic libraries and kernel modules
 
+
'''/lost+found'''
+
Some trash goes here!
+
 
+
 
'''/media'''
 
'''/media'''
Directory for mounting devices, such as external hard disk or removeable media (floppy, cdrom, dvdrom).
+
is intended as a mount point for external devices, such as hard drives or removable media (floppies, CDs, DVDs).
 
+
 
'''/mnt'''
 
'''/mnt'''
Same as ''/media'', use to mounting devices, Since Breezy Ubuntu doesn't use ''/mnt'' as a default mounting directory, they move into ''/media''.
+
is also a place for mount points, but dedicated specifically to "temporarily mounted" devices, such as network filesystems.
 
+
 
'''/opt'''
 
'''/opt'''
Use to store addition software for your system.
+
can be used to store addition software for your system, which is not handled by the [[UbuntuHelp:InstallingSoftware|package manager]].
 
+
 
'''/proc'''
 
'''/proc'''
A virtual filesystem that provides a mechanism for kernel to send information to processes.
+
is a virtual filesystem that provides a mechanism for kernel to send information to processes.
 
+
 
'''/root'''
 
'''/root'''
The root user's home directory
+
is the [[UbuntuHelp:RootSudo|superuser]]'s home directory, not in <code><nowiki>/home/</nowiki></code> to allow for booting the system even if <code><nowiki>/home/</nowiki></code> is not available.
 
+
 
'''/sbin'''
 
'''/sbin'''
Contains important administrative programs also daemon processes.
+
contains important administrative commands that should generally only be employed by the [[UbuntuHelp:RootSudo|superuser]].
 
+
 
'''/srv'''
 
'''/srv'''
The data directories of services such as HTTP (''/srv/www'')or FTP server.
+
can contain data directories of services such as HTTP (<code><nowiki>/srv/www/</nowiki></code>) or FTP.
 
+
 
'''/sys'''
 
'''/sys'''
A ''/proc'' like file systems.
+
is a virtual filesystem that can be accessed to set or obtain information about the kernel's view of the system.
 
+
 
'''/tmp'''
 
'''/tmp'''
Place for temporary files used by applications.
+
is a place for temporary files used by applications.
 
+
 
'''/usr'''
 
'''/usr'''
System resources, contains subdirectories such as ''/usr/bin'', ''/usr/lib'', ''/usr/share'', ''/usr/include'' and ''/usr/doc''.
+
contains the majority of user utilities and applications, and partly replicates the root directory structure, containing for instance, among others, <code><nowiki>/usr/bin/</nowiki></code> and <code><nowiki>/usr/lib</nowiki></code>.
 
+
 
'''/var'''
 
'''/var'''
Contains Directories of variable data that change rapidly. Inside there important subdirectory ''/var/log'' that manages logfiles of your system.
+
is dedicated variable data that potentially changes rapidly; a notable directory it contains is <code><nowiki>/var/log</nowiki></code> where system log files are kept.
 
+
=== From Here to Where? ===
+
* [http://www.pathname.com/fhs Filesystem Hierarchy Standard]
+
 
----
 
----
[[category:CategoryDocumentation]]
 
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2009年5月12日 (二) 17:43的最新版本

Ubuntu (like all UNIX-like systems) organizes files in a hierarchical tree, where relationships are thought of in teams of children and parent. Directories can contain other directories as well as regular files, which are the "leaves" of the tree. Any element of the tree can be references by a path name; an absolute path name starts with the character / (identifying the root directory, which contains all other directories and files), then every child directory that must be traversed to reach the element is listed, each separated by a / sign. A relative path name is one that doesn't start with /; in that case, the directory tree is traversed starting from a given point, which changes depending on context, called the current directory. In every directory, there are two special directories called . and .., which refer respectively to the directory itself, and to its parent directory. The fact that all files and directories have a common root means that, even if several different storage devices are present on the system, they are all seen as directories somewhere in the tree, once they are mounted to the desired place. FilePermissions are another important part of the files organization system: they are superimposed to the directory structure and assign permissions to each element of the tree, ultimately decided by whom it can be accessed and how.

Examples

An absolute path name, pointing to what is normally an executable file on an Ubuntu system:

/usr/bin/test

An absolute path name, but pointing to a directory instead of a regular file:

/usr/bin/

A relative path name, which will point to /usr/bin/test only if the current directory is /usr/:

bin/test

A relative path name, which will point to /usr/bin/test if the current directory is any directory in /usr/, for instance /usr/share/:

../bin/test

A path name using the special shortcut ~, which refers to the current user's home directory:

~/Desktop/

Path names can contain almost any character, but some characters, such as space, must be escaped in most software, usually by enclosing the name in quotation marks:

"~/Examples/Experience ubuntu.ogg"

or by employing the escape character \:

~/Examples/Experience\ ubuntu.ogg

Main directories

The standard Ubuntu directory structure mostly follows the Filesystem Hierarchy Standard, which can be referred to for more detailed information. Here, only the most important directories in the system will be presented. /bin is a place for most commonly used terminal commands, like ls, mount, rm, etc. /boot contains files needed to start up the system, including the Linux kernel, a RAM disk image and bootloader configuration files. /dev contains all device files, which are not regular files but instead refer to various hardware devices on the system, including hard drives. /etc contains system-global configuration files, which affect the system's behavior for all users. /home home sweet home, this is the place for users' home directories. /lib contains very important dynamic libraries and kernel modules /media is intended as a mount point for external devices, such as hard drives or removable media (floppies, CDs, DVDs). /mnt is also a place for mount points, but dedicated specifically to "temporarily mounted" devices, such as network filesystems. /opt can be used to store addition software for your system, which is not handled by the package manager. /proc is a virtual filesystem that provides a mechanism for kernel to send information to processes. /root is the superuser's home directory, not in /home/ to allow for booting the system even if /home/ is not available. /sbin contains important administrative commands that should generally only be employed by the superuser. /srv can contain data directories of services such as HTTP (/srv/www/) or FTP. /sys is a virtual filesystem that can be accessed to set or obtain information about the kernel's view of the system. /tmp is a place for temporary files used by applications. /usr contains the majority of user utilities and applications, and partly replicates the root directory structure, containing for instance, among others, /usr/bin/ and /usr/lib. /var is dedicated variable data that potentially changes rapidly; a notable directory it contains is /var/log where system log files are kept.