`

Linux File System | linux文件系统

阅读更多
  
Unix Filesystem Hierarchy Standard:
http://www.pathname.com/fhs/pub/fhs-2.3.html#THEFILESYSTEM
Unix directory structure:
http://en.wikipedia.org/wiki/Unix_directory_structure



View file system hierarchy of Linux:
$ man hier


LinuxFilesystemTreeOverview
https://help.ubuntu.com/community/LinuxFilesystemTreeOverview

http://linuxcommand.org/lts0040.php


Linux 分区方案:
https://help.ubuntu.com/community/DiskSpace


使用 update-rc.d 实现linux服务的开机自启动:(rc stands for Run Commands)
How-To: Managing services with update-rc.d:
http://www.debuntu.org/how-to-manage-services-with-update-rc.d
Ubuntu Manpage: update-rc.d - install and remove System-V style init script links:
http://manpages.ubuntu.com/manpages/hardy/man8/update-rc.d.8.html
引用
FILES
       /etc/init.d/
              The directory containing the actual init scripts.

       /etc/rc?.d/
              The directories containing the links used by init and managed by
              update-rc.d.

       /etc/init.d/skeleton
              Model for use by writers of init.d scripts.

       /var/lib/sysv-rc/legacy-bootsequence
              Flag indicating the machine is using legacy mode for boot script
              ordering.
使用update-rc.d管理Linux服务:
http://blog.bornin76.com:801/?p=130


关于 /etc/init.d 目录:
http://www.ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory/


下面存放 binary files(二进制可执行文件) 的目录的区别(sbin之s代表system, usr 代表 Unix System Resources):
/bin/
/sbin/
/usr/bin/
/usr/sbin/
/usr/local/bin/
/usr/local/sbin/
http://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux



.profile .bashrc .bash_profile 的区别:
http://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile
/etc/bash.bashrc 和 ~/.bashrc 的区别:
http://superuser.com/questions/49562/whats-the-difference-between-etc-bash-bashrc-and-bashrc-which-one-should-i
引用
/etc/bash.bashrc applies to all users
~/.bashrc only applies to the user in which home folder it is.
针对单个用户的 ~/.bash_profile 与 ~/.bashrc 的区别:
http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
引用
.bash_profile是在登陆时起作用; .bashrc 是交互式non-login shells,即:修改.bashrc后,脚本在新打开的terminal中就开始起作用了,不用重新登陆。
关于 interactive shell / non-interactive shell、login shell / non-login shell,详见:
http://wuaner.iteye.com/blog/1671522



File Descriptors & IO Redirection:

What's File Descriptors? When a UNIX/linux program wants to use a file, it must first open that file. When it does so, UNIX/linux will associate a number with the file. This number, which is used by the program when reading from and writing to the file, is the file descriptor. linux kernal 的 /usr/include/unistd.h 文件中可查看stdin/stdout/stderr三个 fd 的定义:
/* Standard file descriptors.  */
#define STDIN_FILENO    0   /* Standard input.  */
#define STDOUT_FILENO   1   /* Standard output.  */
#define STDERR_FILENO   2   /* Standard error output.  */
Understanding File Descriptors and IO Redirection:
http://www.symkat.com/understanding-file-descriptors-and-io-redirection
在 File Descriptors 间做 IO Redirection 时的 &,如 2>&1 ,代表了什么?答案是使用 & 仅仅是为了表明被重定向至的文件(stdin、stdout、stderr都是character devices,unix/linux下 character devices 也是被当作文件file来管理的)是stdout,而不是一个名为 1 的文件,参见:
http://en.wikipedia.org/wiki/Redirection_(computing)
引用
In shells derived from csh (the C shell), the syntax instead appends the & (ampersand) character to the redirect characters, thus achieving a similar result. The reason for this is to distinguish between a file named '1' and stdout, i.e. 'cat file 2>1' vs 'cat file 2>&1'. In the first case, stderr is redirected to a file named '1' and in the second, stderr is redirected to stdout.
http://stackoverflow.com/questions/818255/in-the-bash-shell-what-is-21
引用
1 is stdout. 2 is stderr.
Here is one way to remember this construct (altough it is not entirely accurate): at first, 2>1 may look like a good way to redirect stderr to stdout. However, it will actually be interpreted as "redirect stderr to a file named 1". & indicates that what follows is a file descriptor and not a filename. So the construct becomes: 2>&1.
分享到:
评论

相关推荐

    Linux Virtual File System

    Linux虚拟文件系统(VFS,Virtual File System)是Linux内核中的一个重要组成部分,它为不同的文件系统提供了一个统一的接口,使得操作系统可以透明地访问各种类型的文件系统,无论是本地存储的还是网络上的。...

    Linux File System Introduce

    Linux文件系统是一个多层次的存储数据和文件的结构,它提供了一种组织和存储数据的方式,以便用户可以长期保存、共享和访问这些数据。这个系统是操作系统中最重要的组成部分之一,因为它不仅存储数据,还提供了一套...

    嵌入式Linux系统中Overlay文件系统的实现.pdf

    "嵌入式Linux系统中Overlay文件系统的实现" 概述: 嵌入式Linux系统中Overlay文件系统的实现是指在嵌入式Linux系统中引入Overlay文件系统,以满足对系统软件的升级和对系统程序的维护需求。Overlay文件系统是指在...

    Linux_VFS_File_System.rar_.vfs_linux vfs_linux文件系统

    Linux VFS(Virtual File System,虚拟文件系统)是Linux内核中的一个重要组成部分,它为不同的文件系统提供了一个统一的接口,使得操作系统可以透明地访问各种类型的文件系统,无论是本地硬盘上的EXT4、XFS,还是...

    Linux 文件系统介绍

    为了方便地管理和操作这些不同类型的文件系统,Linux 引入了一个称为 VFS(Virtual File System,虚拟文件系统)的概念。VFS 提供了一套通用的接口和框架,使得内核能够透明地处理各种具体的文件系统。这种方式不仅...

    Linux二级文件系统模拟

    在Linux操作系统中,二级文件系统(也称为联合文件系统,Union File System,简称UnionFS)是一种特殊的文件系统技术,它允许将多个文件系统合并为一个逻辑视图。这种技术主要用于容器技术,如Docker,使得可以同时...

    linux下的system.img解压和打包工具 mkyaffs2image

    YAFFS(Yet Another Flash File System)是一种专门为闪存设备设计的文件系统,广泛应用于嵌入式系统,包括Android设备。`system.img`文件往往采用YAFFS2格式,因此,`mkyaffs2image`就成为处理这类文件的关键工具。...

    Red Hat Enterprise Linux 5 Global File System

    Red Hat Global File System(GFS)是一种集群文件系统解决方案,允许多个节点同时访问同一个文件系统。GFS 使用分布式锁机制来确保数据一致性和文件系统的可用性。 Red Hat Enterprise Linux 5 全局文件系统的特点...

    嵌入式Linux文件系统

    在Linux中,不同的文件系统类型(file system types)决定了信息如何存储为文件和目录,每种类型都有其特定的存储策略,有的注重冗余以确保数据安全,有的则优化了存取速度。 嵌入式Linux支持多种文件系统类型,...

    file-system-linux-example.zip_file system

    本压缩包"file-system-linux-example.zip"包含了与Linux文件系统相关的源代码和工具,让我们深入探讨其中涉及的知识点。 1. **文件系统(File System)**: 文件系统是操作系统用来控制存储设备上数据组织的一种方法...

    Linux虚拟文件系统对物理文件的管理

    Linux的强大之处在于它能够支持多种物理文件系统,这得益于其核心设计中的一个重要组成部分——虚拟文件系统(Virtual File System, VFS)。VFS通过抽象出一套通用接口,使得Linux能够无缝地支持不同的文件系统类型,...

    linux文件系统电子书籍

    Linux内核中的虚拟文件系统(Virtual File System, VFS)是一个重要的组件,它提供了一层抽象,允许用户通过统一的接口访问各种类型的文件系统。VFS的主要特点包括: - **通用接口**:通过标准的UNIX系统调用(如`...

    zfs_linux.pdf.tar.gz_ZFS_linux file system

    ZFS(Zeta File System)是Sun Microsystems公司开发的一种先进的、统一的文件系统与存储管理解决方案,最初设计用于Solaris操作系统。随着开源社区的发展,ZFS也被移植到了其他平台,包括Linux。"zfs_linux.pdf.tar...

    Linux虚拟文件系统对物理文件的管理.pdf

    Linux虚拟文件系统(Virtual File System, VFS)是Linux操作系统的核心组成部分,它为不同类型的物理文件系统提供了一个统一的接口,使得Linux内核能够透明地管理和访问这些文件系统。VFS的设计目标是屏蔽各种物理...

    Linux虚拟文件系统实现技术探讨.pdf

    《Linux虚拟文件系统实现技术探讨》一文深入讨论了Linux操作系统中虚拟文件系统(VFS,Virtual File System)的设计理念、关键数据结构及其工作原理,为理解Linux如何统一管理多种物理文件系统提供了详尽的解析。...

    linux 文件系统源码

    1. **VFS(Virtual File System)**:VFS是Linux内核中的一层抽象,它为各种不同的文件系统提供了一个统一的接口。通过VFS,应用程序可以透明地访问各种类型的文件系统,而无需关心其底层实现细节。VFS处理文件操作...

    Red Hat Enterprise Linux 6 Global File System 2

    Red Hat Enterprise Linux 6 Global File System 2 是一个基于Red Hat Enterprise Linux 6操作系统的分布式文件系统解决方案。该系统旨在提供高可用性、可扩展性和高性能的文件存储服务,满足大型企业和组织对文件...

    Red Hat Enterprise Linux 5 Global File System 2

    Red Hat Enterprise Linux 5 Global File System 2(以下简称 GFS2)是一种高可用性的 Cluster 文件系统,旨在提供高性能、可靠性和可扩展性的文件存储解决方案。GFS2 是 Red Hat Enterprise Linux 5 中的一个组件,...

Global site tag (gtag.js) - Google Analytics