`
mylxiaoyi
  • 浏览: 335394 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

The Linux filesystem explained

阅读更多
By Mayank Sarup <mayank@freeos.com>
 Posted: ( 2001-01-03 10:08:44 EST by  )
 The first thing that most new users shifting from Windows will find
 confusing is navigating the Linux filesystem. The Linux filesystem
 does things a lot more differently than the Windows filesystem.
 This article explains the differences and takes you through the
 layout of the Linux filesystem.
For starters, there is only a single hierarchal directory structure.
Everything starts from the root directory, represented by '/', and then
expands into sub-directories. Where DOS/Windows had various partitions and
then directories under those partitions, Linux places all the partitions
under the root directory by 'mounting' them under specific directories.
Closest to root under Windows would be c:.
Under Windows, the various partitions are detected at boot and assigned a
drive letter. Under Linux, unless you mount a partition or a device, the
system does not know of the existence of that partition or device. This
might not seem to be the easiest way to provide access to your partitions
or devices but it offers great flexibility.
This kind of layout, known as the unified filesystem, does offer several
advantages over the approach that Windows uses. Let's take the example of
the /usr directory. This directory off the root directory contains most of
the system executables. With the Linux filesystem, you can choose to mount
it off another partition or even off another machine over the network. The
underlying system will not know the difference because /usr appears to be
a local directory that is part of the local directory structure! How many
times have you wished to move around executables and data under Windows,
only to run into registry and system errors? Try moving c:windowssystem
to another partition or drive.
Another point likely to confuse newbies is the use of the frontslash '/'
instead of the backslash '' as in DOS/Windows. So c:windowssystem would
be /c/windows/system. Well, Linux is not going against convention here.
Unix has been around a lot longer than Windows and was the standard a lot
before Windows was. Rather, DOS took the different path, using '/' for
command-line options and '' as the directory separator.
To liven up matters even more, Linux also chooses to be case sensitive.
What this means that the case, whether in capitals or not, of the
characters becomes very important. So this is not the same as THIS or ThIs
for that matter. This one feature probably causes the most problems for
newbies.
We now move on to the layout or the directory structure of the Linux
filesystem. Given below is the result of a 'ls -p' in the root directory.
bin/ dev/ home/ lost+found/ proc/ sbin/ usr/
boot/ etc/ lib/ mnt/ root/ tmp/ var/
/sbin - This directory contains all the binaries that are essential to the
working of the system. These include system administration as well as
maintenance and hardware configuration programs. Find lilo, fdisk, init,
ifconfig etc here. These are the essential programs that are required by
all the users. Another directory that contains system binaries is /usr/sbin.
This directory contains other binaries of use to the system administrator.
This is where you will find the network daemons for your system along with
other binaries that only the system administrator has access to, but which are
not required for system maintenance, repair etc.
/bin - In contrast to /sbin, the bin directory contains several useful
commands that are used by both the system administrator as well as
non-privileged users. This directory usually contains the shells like
bash, csh etc. as well as much used commands like cp, mv, rm, cat, ls.
There also is /usr/bin, which contains other user binaries. These binaries
on the other hand are not essential for the user. The binaries in /bin
however, a user cannot do without.
/boot - This directory contains the system.map file as well as the Linux
kernel. Lilo places the boot sector backups in this directory.
/dev - This is a very interesting directory that highlights one important
characteristic of the Linux filesystem - everything is a file or a
directory. Look through this directory and you should see hda1, hda2 etc,
which represent the various partitions on the first master drive of the
system. /dev/cdrom and /dev/fd0 represent your CDROM drive and your floppy
drive. This may seem strange but it will make sense if you compare the
characteristics of files to that of your hardware. Both can be read from
and written to. Take /dev/dsp, for instance. This file represents your
speaker device. So any data written to this file will be re-directed to
your speaker. Try 'cat /etc/lilo.conf > /dev/dsp' and you should hear some
sound on the speaker. That's the sound of your lilo.conf file! Similarly,
sending data to and reading from /dev/ttyS0 ( COM 1 ) will allow you to
communicate with a device attached there - your modem.
/etc - This directory contains all the configuration files for your system.
Your lilo.conf file lies in this directory as does hosts, resolv.conf and
fstab. Under this directory will be X11 sub-directory which contains the
configuration files for X. More importantly, the /etc/rc.d directory
contains the system startup scripts. This is a good directory to backup
often. It will definitely save you a lot of re-configuration later if you
re-install or lose your current installation.
/home - Linux is a multi-user environment so each user is also assigned a
specific directory which is accessible only to them and the system
administrator. These are the user home directories, which can be found
under /home/username. This directory also contains the user specific
settings for programs like IRC, X etc.
/lib - This contains all the shared libraries that are required by system
programs. Windows equivalent to a shared library would be a DLL file.
/lost+found - Linux should always go through a proper shutdown. Sometimes
your system might crash or a power failure might take the machine down.
Either way, at the next boot, a lengthy filesystem check using fsck will
be done. Fsck will go through the system and try to recover any corrupt
files that it finds. The result of this recovery operation will be placed
in this directory. The files recovered are not likely to be complete or
make much sense but there always is a chance that something worthwhile is
recovered.
/mnt - This is a generic mount point under which you mount your filesystems
or devices. Mounting is the process by which you make a filesystem
available to the system. After mounting your files will be accessible
under the mount-point. This directory usually contains mount points or
sub-directories where you mount your floppy and your CD. You can also
create additional mount-points here if you want. There is no limitation to
creating a mount-point anywhere on your system but convention says that
you do not litter your file system with mount-points.
/opt - This directory contains all the software and add-on packages that
are not part of the default installation. Generally you will find KDE and
StarOffice here. Again, this directory is not used very often as it's
mostly a standard in Unix installations.
/proc - This is a special directory on your system. We have a more detailed
article on this one here.
/root - We talked about user home directories earlier and well this one is
the home directory of the user root. This is not to be confused with the
system root, which is directory at the highest level in the filesystem.
/tmp - This directory contains mostly files that are required temporarily.
Many programs use this to create lock files and for temporary storage of
data. On some systems, this directory is cleared out at boot or at
shutdown.
/usr - This is one of the most important directories in the system as it
contains all the user binaries. X and its supporting libraries can be
found here. User programs like telnet, ftp etc are also placed here.
/usr/doc contains useful system documentation. /usr/src/linux contains the
source code for the Linux kernel.
/var - This directory contains spooling data like mail and also the output
from the printer daemon. The system logs are also kept here in
/var/log/messages. You will also find the database for BIND in /var/named
and for NIS in /var/yp.
This was a short and basic look at the Linux filesystem. You do need to
have at least this basic knowledge of the layout of the filesystem to
fully utilize its potential. One good place to read about the filesystem
is this detailed document at www.pathname.com/fhs/1.2/fsstnd-toc.html that
specifies the standard structure of the Linux filesystem.
分享到:
评论

相关推荐

    Learning Android: Develop Mobile Apps Using Java and Eclipse(第二版)

    The Filesystem Explained Summary Chapter 10 Services Our Example Service: RefreshService Pulling Data from Yamba Summary Chapter 11 Content Providers Databases on Android Status Contract Class Update ...

    Ubuntu Pocket Guide and Reference: A concise companion for day-to-day Ubuntu use

    The book then describes the highways of the Ubuntu filesystem, and gives a full run-down of the Ubuntu file manager. Next, the command-line is tackled in-depth, after which software management is ...

    Professional C++, 4th Edition

    Case studies include extensive, working code that has been tested on Windows and Linux, and the author’s expert tips, tricks, and workarounds can dramatically enhance your workflow. Even many ...

    基于MATLAB GUI的学生成绩管理系统:功能实现与应用

    内容概要:本文介绍了一款基于MATLAB GUI的学生成绩管理系统,旨在提升学校教学管理的效率和准确性。系统主要由三个模块组成:考试收录数据模块、考试数据分析模块和统计分析数据模块。它不仅支持成绩的录入、显示、排序、查找,还包括特征值分析、直方图绘制和教师评语录入等功能。通过对成绩数据的综合分析,系统能为学校教学管理提供客观科学的数据支持。 适合人群:教育工作者(如教师、管理人员)和技术爱好者(特别是对MATLAB GUI感兴趣的开发者)。 使用场景及目标:适用于各类学校和教育机构,用于管理和分析学生成绩,帮助教师和管理者更好地了解学生的学习状况,改进教学质量。 阅读建议:对于希望深入了解如何利用MATLAB GUI进行学生成绩管理的读者来说,本文提供了详细的系统设计思路和功能实现方法,值得仔细研读并尝试实践。

    基于T-Mats库的涡扇发动机气路故障仿真模型:自定义故障植入与真实运行扰动分析

    内容概要:本文介绍了基于T-Mats库的涡扇发动机气路故障仿真模型,涵盖了多种类型的故障植入(如部件流量、效率及压比故障),并允许自定义故障程序和组合。该模型通过对软阈值去噪处理后的信号序列进行分析,提取真实的运行扰动信息,确保输出数据符合CMAPASS的排列要求。此外,该模型能够模拟航空发动机的典型气路故障,帮助研发和技术人员更准确地预测和评估发动机性能,从而提前采取预防措施。 适合人群:航空航天领域的研发人员、技术人员以及对航空发动机故障仿真感兴趣的学者。 使用场景及目标:①用于研究和开发涡扇发动机的气路故障诊断系统;②辅助工程师进行故障预测和性能评估;③为后续数据分析和实验验证提供可靠的数据基础。 其他说明:该模型不仅提高了仿真的准确性,还增强了对发动机运行状态的理解,为提升发动机性能和可靠性提供了强有力的技术支持。

    scratch少儿编程逻辑思维游戏源码-scratch冒险.zip

    scratch少儿编程逻辑思维游戏源码-scratch冒险.zip

    少儿编程scratch项目源代码文件案例素材-爬塔.zip

    少儿编程scratch项目源代码文件案例素材-爬塔.zip

    合金凝固模型中的相场模拟与各向异性枝晶生长研究及其在激光增材制造中的应用

    内容概要:本文详细探讨了合金凝固模型中的相场模拟方法及其在各向异性枝晶生长研究中的应用。首先介绍了合金凝固模型的基本概念及其在现代制造业中的重要性,特别是在激光增材制造、选择性激光熔融和定向凝固技术中的应用。接着,重点讨论了相场模拟作为一种数值模拟方法,在预测合金凝固过程中组织结构演变方面的关键作用。文中还提供了MATLAB实现合金各向异性枝晶生长的具体代码及详细注释,以及Comsol用于偏微分方程求解的雪花生长模型。最后,文章总结了当前的研究进展,并展望了未来的发展趋势。 适合人群:从事材料科学、冶金工程、激光增材制造领域的研究人员和技术人员,尤其是对相场模拟和合金凝固感兴趣的学者。 使用场景及目标:适用于希望深入了解合金凝固过程、相场模拟方法及其在现代制造技术中应用的专业人士。目标是提高对合金凝固机制的理解,优化制造工艺,提升产品质量。 其他说明:文章不仅提供了理论分析,还包括具体的代码实现和详细的文献参考资料,有助于读者全面掌握相关技术和最新研究进展。

    少儿编程scratch项目源代码文件案例素材-史莱姆出击.zip

    少儿编程scratch项目源代码文件案例素材-史莱姆出击.zip

    少儿编程scratch项目源代码文件案例素材-忍者酷跑.zip

    少儿编程scratch项目源代码文件案例素材-忍者酷跑.zip

    scratch少儿编程逻辑思维游戏源码-点击灌篮.zip

    scratch少儿编程逻辑思维游戏源码-点击灌篮.zip

    基于RBF神经网络的PID控制器在PMSM转速环中的Simulink模型设计与性能分析

    内容概要:本文介绍了将基于RBF神经网络的PID控制器应用于永磁同步电机(PMSM)转速环控制的方法及其性能优势。传统的PID控制器在面对非线性和时变系统时存在参数整定困难的问题,而引入RBF神经网络可以实现实时在线调参,提高系统的灵活性和鲁棒性。文中详细描述了Simulink模型的设计,特别是Matlab s-function模块中RBF神经网络的具体实现,包括高斯函数激活和带惯性的权值更新机制。实验结果显示,在转速突变情况下,改进后的控制器能够迅速稳定系统,超调量控制在2%以内,调节时间较传统方法缩短约40%,并且在负载变化时表现出色,无需重新整定参数。 适合人群:从事电机控制系统研究和开发的技术人员,尤其是对PID控制器优化感兴趣的工程师。 使用场景及目标:适用于需要提升PMSM转速环控制精度和响应速度的应用场合,如工业自动化设备、机器人等领域。目标是通过引入智能算法解决传统PID控制器参数整定难题,提高系统性能。 阅读建议:关注RBF神经网络与PID控制器结合的具体实现细节,特别是在Matlab s-function模块中的编码技巧以及参数调整策略。同时,注意学习率的选择和动量项的作用,这对于实际应用至关重要。

    scratch少儿编程逻辑思维游戏源码-Scratch 奔跑.zip

    scratch少儿编程逻辑思维游戏源码-Scratch 奔跑.zip

    基于COMSOL有限元仿真的变压器辐射传热数值分析:从入门到进阶

    内容概要:本文详细介绍了基于COMSOL有限元软件的变压器辐射传热数值分析方法。首先,解释了变压器内外辐射传热的基本机理,包括热量通过传导、对流和辐射的方式传递,重点在于辐射传热的作用及其数学描述。接着,逐步引导读者从零开始构建有限元仿真模型,涵盖模型参数确定、网格划分、材料属性定义、边界条件设置、传热方程设定、仿真运行及结果分析等多个步骤。最后,探讨了进一步研究的方向,如不同因素(温度、材料属性、几何形状)对辐射传热的影响,以及该模型在电力电子设备和热管理系统的潜在应用。 适合人群:电气工程专业学生、初学者和技术爱好者,尤其是对有限元仿真和变压器辐射传热感兴趣的群体。 使用场景及目标:适用于希望通过实际操作掌握有限元仿真技能的人群,旨在帮助他们理解变压器辐射传热机制并能独立完成相关仿真项目。 其他说明:本文不仅提供了理论知识,还附带了详细的视频教程和仿真模型,使学习过程更加直观易懂。

    交错并联Boost PFC仿真电路模型:基于双闭环控制的BCM模式优化与应用

    内容概要:本文详细介绍了交错并联Boost PFC(功率因数校正)仿真电路模型的设计与实现,特别是在临界BCM模式下的双闭环控制特性。文章首先解释了该电路的经典结构及其优势,即能够有效降低开关损耗和电流纹波。接着,重点讨论了双闭环控制的具体实现方法,包括外环电压控制和内环电流控制的MATLAB/Simulink代码示例。文中还特别强调了电流环中零交叉检测的重要性以及交错并联结构中驱动信号相位差的精确设置。此外,作者分享了将模型从Simulink转换到Plecs和Psim时遇到的问题及解决方案,如更换为带反向恢复特性的二极管模型和重新校准控制环路的采样周期。最后,文章展示了优化后的电流波形图,验证了所提方法的有效性。 适合人群:电力电子工程师、电源设计师、从事电力系统仿真的研究人员和技术爱好者。 使用场景及目标:适用于需要进行高效电源设计的研究和开发项目,旨在提高电源系统的性能,减少谐波失真,提升功率因数校正效果。 其他说明:文中提供的具体代码片段和参数设置有助于读者更好地理解和复现实验结果。同时,对于希望深入理解双闭环控制系统和BCM模式的人来说,本文提供了宝贵的实践经验。

    scratch少儿编程逻辑思维游戏源码-3000 横版闯过.zip

    scratch少儿编程逻辑思维游戏源码-3000 横版闯过.zip

    空气涡轮发动机Matlab/Simulink动态仿真模型:部件级建模与PID控制应用

    内容概要:本文介绍了如何利用Matlab/Simulink构建空气涡轮发动机的动态仿真模型。首先,文章详细阐述了各个部件级模型的设计,包括进气道、涡轮、气室、压气机、尾喷管、转子动力学模块和容积模块。接着,重点讨论了PID控制器在维持发动机转速恒定方面的作用,尤其是在面对输出扭矩阶跃扰动时的表现。最后,提供了简单的Simulink模型代码片段,展示了如何设置和运行仿真模型,以便实时监控和调整发动机性能。 适合人群:航空航天工程领域的研究人员和技术人员,尤其是那些对空气涡轮发动机仿真感兴趣的读者。 使用场景及目标:适用于希望通过Matlab/Simulink进行空气涡轮发动机仿真研究的专业人士。主要目标是掌握空气涡轮发动机各部件的工作原理及其相互关系,同时学会使用PID控制器优化发动机性能。 其他说明:本文不仅提供了理论知识,还附有实际操作步骤和代码示例,帮助读者更好地理解和应用所学内容。

    少儿编程scratch项目源代码文件案例素材-收集能量.zip

    少儿编程scratch项目源代码文件案例素材-收集能量.zip

    scratch少儿编程逻辑思维游戏源码-弹回的球.zip

    scratch少儿编程逻辑思维游戏源码-弹回的球.zip

    少儿编程scratch项目源代码文件案例素材-铅笔画.zip

    少儿编程scratch项目源代码文件案例素材-铅笔画.zip

Global site tag (gtag.js) - Google Analytics