当前位置: 首页 > news >正文

理解Linux文件系统

本文系转载,原文转自:http://www.thegeekstuff.com/2010/09/linux-file-system-structure/

Have you wondered why certain programs are located under /bin, or /sbin, or /usr/bin, or /usr/sbin?

For example, less command is located under /usr/bin directory. Why not /bin, or /sbin, or /usr/sbin? What is the different between all these directories?

In this article, let us review the Linux filesystem structures and understand the meaning of individual high-level directories.

1. / – Root

  • Every single file and directory starts from the root directory.
  • Only root user has write privilege under this directory.
  • Please note that /root is root user’s home directory, which is not same as /.

2. /bin – User Binaries

  • Contains binary executables.
  • Common linux commands you need to use in single-user modes are located under this directory.
  • Commands used by all the users of the system are located here.
  • For example: ps, ls, ping, grep, cp.

3. /sbin – System Binaries

  • Just like /bin, /sbin also contains binary executables.
  • But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
  • For example: iptables, reboot, fdisk, ifconfig, swapon

4. /etc – Configuration Files

  • Contains configuration files required by all programs.
  • This also contains startup and shutdown shell scripts used to start/stop individual programs.
  • For example: /etc/resolv.conf, /etc/logrotate.conf

5. /dev – Device Files

  • Contains device files.
  • These include terminal devices, usb, or any device attached to the system.
  • For example: /dev/tty1, /dev/usbmon0

6. /proc – Process Information

  • Contains information about system process.
  • This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
  • This is a virtual filesystem with text information about system resources. For example: /proc/uptime

7. /var – Variable Files

  • var stands for variable files.
  • Content of the files that are expected to grow can be found under this directory.
  • This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);

8. /tmp – Temporary Files

  • Directory that contains temporary files created by system and users.
  • Files under this directory are deleted when system is rebooted.

9. /usr – User Programs

  • Contains binaries, libraries, documentation, and source-code for second level programs.
  • /usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
  • /usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
  • /usr/lib contains libraries for /usr/bin and /usr/sbin
  • /usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2

10. /home – Home Directories

  • Home directories for all users to store their personal files.
  • For example: /home/john, /home/nikita

11. /boot – Boot Loader Files

  • Contains boot loader related files.
  • Kernel initrd, vmlinux, grub files are located under /boot
  • For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic

12. /lib – System Libraries

  • Contains library files that supports the binaries located under /bin and /sbin
  • Library filenames are either ld* or lib*.so.*
  • For example: ld-2.11.1.so, libncurses.so.5.7

13. /opt – Optional add-on Applications

  • opt stands for optional.
  • Contains add-on applications from individual vendors.
  • add-on applications should be installed under either /opt/ or /opt/ sub-directory.

14. /mnt – Mount Directory

  • Temporary mount directory where sysadmins can mount filesystems.

15. /media – Removable Media Devices

  • Temporary mount directory for removable devices.
  • For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer

16. /srv – Service Data

  • srv stands for service.
  • Contains server specific services related data.
  • For example, /srv/cvs contains CVS related data.

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 沙盒SandBox
  • Python数据类型间互转(字典、字符串、列表、元组)
  • 输入n个整数,输出其中最小的k个
  • cocos2dx 3.x 精灵重叠时点击最上层的精灵
  • 输入一个整型数组,求所有子数组中和的最大值
  • 软件测试知识之分类
  • 算法导论学习笔记——贪心算法
  • web前端开发浏览器兼容性处理大全
  • 算法导论学习笔记——动态规划
  • Google技术学习
  • 【无聊放个模板系列】 半平面交
  • 最长公共子序列(LCS)问题
  • 01背包问题
  • JS控制文本框只能输入中文、英文、数字与指定特殊符号.
  • iOS僵尸对象之研究
  • [ 一起学React系列 -- 8 ] React中的文件上传
  • C++入门教程(10):for 语句
  • CAP 一致性协议及应用解析
  • js操作时间(持续更新)
  • Laravel Mix运行时关于es2015报错解决方案
  • mysql innodb 索引使用指南
  • Wamp集成环境 添加PHP的新版本
  • Yeoman_Bower_Grunt
  • 构造函数(constructor)与原型链(prototype)关系
  • 回顾2016
  • 基于axios的vue插件,让http请求更简单
  • 解决jsp引用其他项目时出现的 cannot be resolved to a type错误
  • 跨域
  • 如何抓住下一波零售风口?看RPA玩转零售自动化
  • 说说动画卡顿的解决方案
  • 一个完整Java Web项目背后的密码
  • 在weex里面使用chart图表
  • 责任链模式的两种实现
  • 国内唯一,阿里云入选全球区块链云服务报告,领先AWS、Google ...
  • 曾刷新两项世界纪录,腾讯优图人脸检测算法 DSFD 正式开源 ...
  • ​马来语翻译中文去哪比较好?
  • ​软考-高级-信息系统项目管理师教程 第四版【第23章-组织通用管理-思维导图】​
  • # linux 中使用 visudo 命令,怎么保存退出?
  • #java学习笔记(面向对象)----(未完结)
  • #数据结构 笔记一
  • $().each和$.each的区别
  • (~_~)
  • (11)MATLAB PCA+SVM 人脸识别
  • (7)STL算法之交换赋值
  • (二)WCF的Binding模型
  • (黑马点评)二、短信登录功能实现
  • (回溯) LeetCode 78. 子集
  • (未解决)jmeter报错之“请在微信客户端打开链接”
  • (译)2019年前端性能优化清单 — 下篇
  • (原創) 未来三学期想要修的课 (日記)
  • (转)重识new
  • .NET Core/Framework 创建委托以大幅度提高反射调用的性能
  • .NET Windows:删除文件夹后立即判断,有可能依然存在
  • .Net 代码性能 - (1)
  • .net 前台table如何加一列下拉框_如何用Word编辑参考文献