Files and Directories

FHS

This article we will look around a GNU/Linux System. The Filesystem Hierarchy Standard (FHS) defines the standard of directory configuration regarding Linux system.
According to a file system using frequently or not and whether a user is allowed to change freely, the directory is defined four interaction forms by FHS.

  • shareable
  • unshareable
  • static
  • variable

Directory introduce

  1. / (root): related to boot system. The root directory is the most important in entire system, because not only all directories are derived from root, but also it is related to the operation of boot,reduction and system repair and so on.
  2. /usr (UNIX software resource): related to software install and execute
  3. /var (variable): related to the operation of the system

Here is a directory tree and diagram showing some of the common directories right beneath the root directory whose name is just “/”.

Directory Tree

If you want to look into the structure of a directory, you can use bash command tree to list contents of directories in a tree-like format. For example, now we want to scan sub-directories of root(“/”) directory, we can type this in bash shell:

gehan@gehan-Lenovo-G480:~$ cd /
gehan@gehan-Lenovo-G480:/$ tree -d -L 1
.
├── bin
├── boot
├── cdrom
├── dev
├── etc
├── home
├── lib
├── lib32
├── lib64
├── lost+found
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin
├── srv
├── sys
├── tmp
├── usr
└── var

22 directories
gehan@gehan-Lenovo-G480:/$ 

So we can see there are 22 one-level directories under root. For the options that used by tree, their detail can be obtained by type man tree.

  • -d: List directories only.
  • -L: Max display depth of the directory tree.
  • and so on.

Diagram

Most of the time you don’t need to know about the directory structure outside your home directory, but this knowledge occasionally comes in handy. Perhaps the most common uses are when you want to change a system-wide configuration file or view log messages, which record things going on and may reveal the source of problems on your system. (Log messages are usually found in the /var/log directory.)

DirsContents
/binbasic programs (Programs that are absolutely needed, shell and commands only)
/bootinitialization files (Required to actually boot your computer)
/devdevice files (Describe physical stuff like hard disks and partitions)
/etcconfiguration files
/homeuser’s home directories
/libbasic libraries (Required by the basic programs)
/mediamount points for removable media
/mntmount points (For system admins who need to temporarily mount a filesystem)
/optthird-party programs
/procprocess filesystem (Describe processes and status information, not stored on disk)
/rootsystem administrator’s files
/sbinbasic administration programs (Like bin, but only usable by administrator)
/srvservice-specific files
/syssystem filesystem (Similar to process, stored in memory based filesystem: tempfs)
/tmptemporary files (Files not kept between boots, often in tempfs)
/usrmost programs (Another bin,etc,lib,sbin, but for less important files)
/varvariable data (Similar to tmp, but preserved between reboots)

Reference

  1. FHS standard official document: http://www.pathname.com/fhs/ “FHS”
  2. die.net:http://linux.die.net/man/1/tree “tree command”
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值