# File Permission & Directory Configuration
###### tags: `centos7` `fileSystems`
date: 3/28
[TOC]
# Linux Directory Configuration
[Reference](https://linux.vbird.org/linux_basic/centos7/0230filesystem.php)
## HFS
Filesystem Hierarchy Standard (FHS) -> linux Direcotry 標準

shareable -> 可以給起他人mount
架構圖

---
## /
root directory 負責 boot, 還原, system 修復
跟目錄 在FHS stander 下 root directory 竟量不要放額外東西
## /bin
bin folder 放 binary file
這裡的Binary File 可以被root與一般帳號 去 exec
e.g.
/usr/bin/python3
Note: 在單人維護模式下還能夠被run 的Binary FIle
## /boot
開機會使用到的檔案
## /dev
Dev folder 有
Virtual 虛擬 -> tty
Physical 實體 -> sda
周邊Device都是以檔案的型態存在於這個目錄
```
[centos@localhost dev]$ ls sda* tty*
sda tty10 tty17 tty23 tty3 tty36 tty42 tty49 tty55 tty61 ttyS1
sda1 tty11 tty18 tty24 tty30 tty37 tty43 tty5 tty56 tty62 ttyS2
sda2 tty12 tty19 tty25 tty31 tty38 tty44 tty50 tty57 tty63 ttyS3
sda3 tty13 tty2 tty26 tty32 tty39 tty45 tty51 tty58 tty7
tty tty14 tty20 tty27 tty33 tty4 tty46 tty52 tty59 tty8
tty0 tty15 tty21 tty28 tty34 tty40 tty47 tty53 tty6 tty9
tty1 tty16 tty22 tty29 tty35 tty41 tty48 tty54 tty60 ttyS0
```
e.g. /dev/null, /dev/zero, /dev/tty, /dev/loop*, /dev/sd*
## /etc (Server Configuration)
Important
### /etc/issue
```
[root@localhost etc]# cat /etc/issue
\S
Kernel \r on an \m
```
### /etc/fstab
```
[root@localhost etc]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Feb 18 21:34:31 2023
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=011a7a42-834e-4c23-aa8a-b723edec15fc / xfs defaults 0 0
UUID=95eb5b4a-0326-48ab-b4e8-d961a1b6eaf8 /boot xfs defaults 0 0
UUID=d4120c50-43d9-41da-a124-93dcf9f55359 swap swap defaults 0 0
```
system 啟動時 會根據這個 配置檔 來自動Mount Partitions
## /lib
會放 /bin 下 或 /sbin 下 program 需要用到的libiray
boot 時 會用到的 library
Static Lib
file.A
Dynamic Lib
fileName.so
### /lib/modules/
可抽換式的核心相關模組
### /lib<qual>
lib64 -> Support 64 bit (library)
## /opt
第三方軟體放置的目錄
## /var
第二層 FHS 設定
放置變動性的資料 e.g. web , login log
### /var/log/ (login Record)
會放登入 info
### /var/lock/
檔案資源一次只能被一個應用程式所使用
### /var/spool
放一些 住列性資料
## /usr (Unix Software Resource)
Unix作業系統軟體資源
第二層 FHS 設定 (建議要有)
Shareable static (可分享不可變)
Shareable -> NFS Server (透過Network <- share-> partition ) "Network filer systems"
### /usr/bin/
一般User -> 可以使用的CMD
/bin ---Link---> /usr/bin
### /usr/sbin
非系統正常運作所需要的系統指令
### /usr/share/
放可以讀的File or 共享文件
/usr/share/wordllists
---
Package Manager (第三方)
## /sbin
super user -> 才能使用的 Binary File
開機 修復 還原系統所需要的指令
----
### /usr/sbin/
伺服器軟體程式
Super Binary -> 需要 root 去Run binary Execute
### /usr/local/sbin
自行安裝的軟體
## /home
### ~user
會切到該使用者的home directory
```
[root@localhost sbin]# cd ~centos
[root@localhost centos]# pwd
/home/centos
```
會放 User folder
## /root
Root的Home directory 會放在這裡 是因為進入單人維護模式而僅掛載根目錄時, 該目錄就能夠擁有root的家目錄 root的家目錄與根目錄就會放置在同一個分割槽中
### /etc (system configure )
resolve.conf -> setting DNS
### /tmp
Read/Write/Execute (任何人)
### /mnt (掛載)
掛載某些額外的裝置
mount
## /proc
它屬於 Virtual File Systems (不佔硬碟容量)
Data 會放在 Memory (systems kernel, process, device , Network Status)
Programe 透過 loder run 起來 會變成 Process
### /proc/net/*
### /proc/info
[Reference](https://www.cnblogs.com/wxxjianchi/p/10522049.html)
```shell
[centos@localhost ~]$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 78
model name : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
stepping : 3
microcode : 0xffffffff
cpu MHz : 2400.000
cache size : 3072 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 arat spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips : 4800.00
clflush size : 64
cache_alignment : 64
address sizes : 45 bits physical, 48 bits virtual
power management:
```
physical id -> 實際 CPU 的數量
cpu cores -> 每張 CPU core 數量
逻辑CPU=物理CPU个数×每颗核数