小墨の博客

梦想需要付诸行动,否则只能是梦

Ubuntu 操作系统的文件系统目录结构

本文介绍 Ubuntu 操作系统的文件系统目录结构,参考 Ubuntu 的官方文档:source URL

Ubuntu(像所有类UNIX系统一样)在分层树中组织文件,其中的关系就像父母和孩子一样。目录可以包含其他目录以及常规文件,它们是树的“叶子”。树的任何元素都可以通过路径名引用;绝对路径以字符 / (标识根目录,其中包含所有其他目录和文件)开头,然后列出必须遍历以到达该元素的每个子目录,每个子目录用 / 符号分隔。相对路径名是不以 / 开头的名称;在这种情况下,从给定点开始遍历目录树,该点根据上下文而变化,称为当前目录。在每个目录中,都有两个名为的特殊目录。. 和 .. ,分别指向目录本身及其父目录。

所有文件和目录都具有公共根的事实意味着,即使系统上存在多个不同的存储设备,一旦将它们安装到所需位置,它们都被视为树中某处的目录。文件权限是文件组织系统的另一个重要部分:它们被叠加到目录结构并为树的每个元素分配权限,最终由谁可以访问以及如何访问。

例子(在 Ubuntu 系统中):

  • 一个绝对路径的名字代表一个普通文件或者可执行文件。

    • /usr/bin/test

  • 一个绝对路径代表一个目录,而不是一个普通文件。

    • /usr/bin/

  • 一个相对路径,只有当当前目录是 /usr/ 时,代表 /usr/bin/test

    • bin/test

  • 一个相对路径,只有当当前目录在 /usr/ 的下一级子目录,如:/usr/share/ 时,代表 /usr/bin/test

    • ../bin/test

  • 一个快捷的方式,可以使用 ~ 指向用户的家目录。

    • ~/Desktop/

  • 文件路径可以包含大多数的字符,但是一些特殊的字符,例如空格,要想使用,就得使用引号将文件路径引起来,或者使用 \ 作为转义字符。

    • "~/Examples/Experience ubuntu.ogg" 或者 ~/Examples/Experience\ ubuntu.ogg

1. 主要目录

Ubuntu 标准的目录结构是符合文件系统层次标准的,可以去官网查看更多详细信息,由于本文介绍的是 Ubuntu 的目录结构,就先不介绍它了,以后的文章会详细介绍,现在你可以通过这个链接查看:文件系统层次标准

下面列举一些在 Ubuntu 系统中出现的文件目录。

  • /bin

    • 这是存放常用的终端命令的目录,例如:ls、mount、rm 等等。

  • /boot

    • 存放系统启动所需的文件,包括 linux kernel,一个随机存储磁盘镜像和 Bootloader 的配置文件。

  • /dev

    • 这个目录存放所有的设备文件,这些不是常规文件,而是指系统上的各种硬件设备,包括硬盘驱动器。

  • /etc

    • 存放系统的全局配置文件,这里面的配置文件会影响系统所有用户的系统环境。

  • /home

    • 用户的家目录,每个用户都有自己的家目录。

  • /lib

    • 存放非常重要的动态库和内核模块。

  • /media

    • 作为外部设备的一个挂载点,比如硬盘或者可移动设备(U盘、DVD、CD)。

  • /mnt

    • 和 /media 一样,也是一个挂载点,但是专用于挂载临时的设备,例如网络文件系统。

  • /opt

    • 用于安装系统额外的软件,这里安装的软件是手动安装的,不受 Ubuntu 软件管理包的管理。

  • /proc

    • 一个虚拟文件系统,为内核提供向进程发送信息的机制。

  • /root

    • root 用户的家目录,不在 /home/ 中,即使 /home/ 不可用,也允许引导系统。

  • /run

    • 在引导过程的早期可用的tmpfs(临时文件系统),其中存储了临时运行时数据。此目录下的文件将在引导过程开始时删除或截断。

  • /sbin

    • 包含通常只应由超级用户使用的重要管理命令。

  • /srv

    • 包含 HTTP(/srv/www/)或 FTP 等服务的数据目录。

  • /sys

    • 可以访问的虚拟文件系统,用于设置或获取有关内核系统视图的信息。

  • /tmp

    • 应用程序使用的临时文件的位置。

  • /usr

    • 包含大多数用户实用程序和应用程序,并部分复制根目录结构,包括例如 /usr/bin/ 和 /usr/lib。

  • /var

    • 致力于可变数据,例如日志,数据库,网站和临时脱机(电子邮件等)文件,这些文件从一次启动到下一次启动。它包含的一个值得注意的目录是 /var/log,其中保存了系统日志文件。

2. 说说想法

上篇文章介绍了怎么在物理机上安装 Ubuntu Desktop 操作系统。我们只是安装完了,进入了一个 Ubuntu 的默认桌面,Linux 的桌面环境也是有很多的,比如:KDE、GNOME、XFCE、UNITY、MATE、DEEPIN 等等。Ubuntu 系统以前是默认使用 UNITY 桌面环境的,从 17.10 开始官方默认使用了 GNOME 桌面环境。我们之前安装的系统就是 GNOME 桌面环境。安装完的桌面环境看上去总是没那么舒服,不美观,所以需要根据自己的需要做一些美化。

今天我补充介绍了安装过程中提到的 Linux 文件系统目录结果。本文是翻译 Ubuntu 官方的文档。别人已经说的很清楚了,所以我翻译过来分享给大家。从下篇文章开始,我将介绍 GNOME 桌面环境下的一些自带的设置和美化的软件,通过介绍这些软件的过程来美化我们的操作系统桌面环境。

所谓磨刀不误砍柴工,当我们把环境搞好后,用着也舒服了,我会给大家慢慢介绍 Linux 的一些基本命令,让大家能够在 Ubuntu 系统上知道怎么安装软件,卸载软件,知道怎么做一些基本的操作。这样基本上就可以大致了解 Ubuntu 系统的使用了,接着会介绍一些常用的软件,来提高我们的工作效率,比如如何记笔记,如何和服务器通信,比如一些娱乐放松的软件等。相信大家会喜欢上 Linux 系统的。

现在我只能按照我想到的流程来写文章介绍 Linux 的使用,如果你有什么好的建议,欢迎给我留言哦。


本文全文转载自:https://blog.51cto.com/8780862/2372399

张小弟之家

本文链接:
文章标题:

本站文章除注明转载/出处外,均为原创,若要转载请务必注明出处。转载后请将转载链接通过邮件告知我站,谢谢合作。本站邮箱:admin@only4.work

尊重他人劳动成果,共创和谐网络环境。点击版权声明查看本站相关条款。

    • 评论列表:
    •  2291200076
       发布于 2021-03-19 22:58:32  回复该评论
    • 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,
    •  2291200076
       发布于 2021-03-19 22:58:23  回复该评论
    • 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
    •  2291200076
       发布于 2021-03-19 22:58:11  回复该评论
    • https://help.ubuntu.com/community/LinuxFilesystemTreeOverview
      LinuxFilesystemTreeOverview
      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 referenced 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 tha

    发表评论:

    搜索
    本文二维码
    标签列表
    站点信息
    • 文章总数:508
    • 页面总数:20
    • 分类总数:92
    • 标签总数:208
    • 评论总数:61
    • 浏览总数:225323

    | | |
    | |  Z-Blog PHP