Linux—文件树

JSON 2024-04-10 15:58:39 157

文件系统层次结构标准

许多 Linux 发行版部分遵循文件系统层次结构标准。 FHS (文件系统层次结构标准)可能有助于使更多的 Unix/Linux 文件系统树在未来更好地符合标准从 FHS 得知,文件系统层次结构标准旨在供 Unix 发行版开发人员、软件包开发人员和系统实现人员使用。然而,它的主要目的是作为参考,而不是关于如何管理 Unix 文件系统或目录层次结构的教程。

曼希尔

Linux 发行版之间的文件系统存在一些差异。有关您的计算机的帮助,请输入 man hier 以查找有关文件系统层次结构的信息。本手册将解释您计算机上的目录结构。

根目录/

所有Linux系统都有一个从根目录(根目录的主目录)开始的目录结构。根目录由正斜杠表示,如下所示:/。 Linux 系统上存在的所有内容都可以在此根目录下找到。我们简单看一下根目录的内容。

datasoft@datasoft-linux:~$ ls /
bin   cdrom  etc   initrd.img  lost+found  mnt  proc  run   srv  tmp  var
boot  dev    home  lib         media       opt  root  sbin  sys  usr  vmlinuz

二进制目录

二进制文件是包含已编译源代码(或机器代码)的文件。二进制文件可以在计算机上执行。有时二进制文件称为可执行文件。

/垃圾桶

/bin 目录包含标准系统实用程序。根据 FHS,/bin 目录应包含 /bin/cat 和 /bin/date(以及其他)。以下信息显示了常见的 Unix/Linux 命令,如 cat、cp、cpio、date、dd、echo、grep 等。

datasoft@datasoft-linux:~$ ls /bin
bash                  fgconsole   nc                       sed
bunzip2               fgrep       nc.openbsd               setfacl
busybox               findmnt     netcat                   setfont
bzcat                 fuser       netstat                  setupcon
bzcmp                 fusermount  nisdomainname            sh
bzdiff                getfacl     ntfs-3g                  sh.distrib
bzegrep               grep        ntfs-3g.probe            sleep
bzexe                 gunzip      ntfs-3g.secaudit         ss
bzfgrep               gzexe       ntfs-3g.usermap          static-sh
bzgrep                gzip        ntfscat                  stty
bzip2                 hostname    ntfsck                   su
bzip2recover          ip          ntfscluster              sync
bzless                kbd_mode    ntfscmp                  tailf
bzmore                kill        ntfsdump_logfile         tar
cat                   kmod        ntfsfix                  tempfile
chacl                 less        ntfsinfo                 touch
...

其他 /bin 目录

您可以在许多其他目录中找到 /bin 子目录。名为 serena 的用户可以将自己的程序放在 /home/serena/bin 中。某些应用程序通常在直接从源代码安装时会将自己放入 /opt 中。 samba 服务器安装可以使用 /opt/samba/bin 来存储其二进制文件。

/sbin

T/sbin 包含用于配置操作系统的二进制文件。许多系统二进制文件需要 root 权限才能执行某些任务。下面的屏幕截图包含用于更改 IP 地址、磁盘分区和创建 ext4 文件系统的系统二进制文件。

datasoft@datasoft-linux:~$ ls -l /sbin/ifconfig /sbin/fdisk /sbin/mkfs.ext4
-rwxr-xr-x 1 root root 105444 Apr 16 21:37 /sbin/fdisk
-rwxr-xr-x 1 root root  69484 Dec  8  2013 /sbin/ifconfig
lrwxrwxrwx 1 root root      6 Jun 20 11:30 /sbin/mkfs.ext4 -> mke2fs

/lib

/bin 和 /sbin 中的二进制文件通常使用位于 /lib 中的共享库。下面是/lib部分内容的截图。

datasoft@datasoft-linux:/$ cd lib
datasoft@datasoft-linux:/lib$ ls
apparmor                              libip4tc.so.0         modules
brltty                                libip4tc.so.0.1.0     modules-load.d
cpp                                   libip6tc.so.0         plymouth
crda                                  libip6tc.so.0.1.0     recovery-mode
firmware                              libiptc.so.0          resolvconf
hdparm                                libiptc.so.0.0.0      systemd
i386-linux-gnu                        libxtables.so.10      terminfo
ifupdown                              libxtables.so.10.0.0  udev
init                                  linux-sound-base      ufw
klibc-SDKhWJaiUdo4OxxZ-mvprY1CZus.so  lsb                   xtables
ld-linux.so.2                                               modprobe.d

/lib/模块

通常,Linux 内核从 /lib/modules/$kernel-version/ 加载内核模块。 Linux 内核章节详细讨论了该目录。

/lib32 和 /lib64

我们目前正处于 32 位和 64 位系统之间的过渡。因此,您可能会遇到名为 /lib32 和 /lib64 的目录,它们阐明了库编译期间使用的寄存器大小。 64 位计算机可能具有一些 32 位二进制文​​件和库,以便与旧应用程序兼容。此屏幕截图使用文件实用程序来演示差异。

自 System V 以来,几乎所有类 Unix 操作系统都使用 ELF(可执行和可链接格式)。

/选择

/opt 的目的是存储可选软件。在许多情况下,这是来自分发存储库外部的软件。您可能会在许多系统上找到空的 /opt 目录。

大型软件包可以将其所有文件安装在 /opt/ $packagename/ 内的 /bin、/lib、/etc 子目录中。例如,如果该软件包名为 wp,则它会安装在 /opt/wp 中,将二进制文件放在 /opt/wp/bin 中,将手册页放在 /opt/wp/man 中。

配置目录

/启动

/boot 目录包含启动计算机所需的所有文件。这些文件不会经常更改。在 Linux 系统上,您通常可以在此处找到 /boot/grub 目录。 /boot/grub 包含 /boot/grub/grub.cfg (较旧的系统可能仍然有 /boot/grub/grub.conf),它定义了内核启动之前显示的引导菜单。

/ETC

所有管理文件和配置文件应位于 /etc 中。很多时候,配置文件的名称与应用程序、守护程序或协议相同,并添加 .conf 作为扩展名。

datasoft@datasoft-linux:/$ ls /etc/*.conf
/etc/adduser.conf          /etc/insserv.conf     /etc/pnm2ppa.conf
/etc/apg.conf              /etc/kernel-img.conf  /etc/popularity-contest.conf
/etc/blkid.conf            /etc/kerneloops.conf  /etc/resolv.conf
/etc/brltty.conf           /etc/ld.so.conf       /etc/rsyslog.conf
/etc/ca-certificates.conf  /etc/libaudit.conf    /etc/sensors3.conf
/etc/colord.conf           /etc/logrotate.conf   /etc/signond.conf
/etc/debconf.conf          /etc/ltrace.conf      /etc/sysctl.conf
/etc/deluser.conf          /etc/mke2fs.conf      /etc/ts.conf
/etc/fuse.conf             /etc/mtools.conf      /etc/ucf.conf
/etc/gai.conf              /etc/netscsid.conf    /etc/updatedb.conf
/etc/hdparm.conf           /etc/nsswitch.conf    /etc/usb_modeswitch.conf
/etc/host.conf             /etc/pam.conf         /etc/wodim.conf
datasoft@datasoft-linux:/$

/etc 中还有更多内容可以找到。

/etc/init.d/

许多 Unix/Linux 发行版都有一个 /etc/init.d 目录,其中包含用于启动和停止守护进程的脚本。当 Linux 迁移到取代旧的 init 方式启动所有守护进程的系统时,该目录可能会消失。

/etc/X11/

图形显示(又名 X Window 系统或简称 X)由 X.org 基金会的软件驱动。图形显示的配置文件是 /etc/X11/xorg.conf。

/etc/skel/

框架目录 /etc/skel 被复制到新创建用户的主目录。它通常包含隐藏文件,例如 .bashrc 脚本。

/etc/系统配置/

这个目录在FHS中没有提到,包含很多Red Hat Enterprise Linux配置文件。我们将更详细地讨论其中一些。下面的屏幕截图是 RHELv4u4 中安装了所有内容的 /etc/sysconfig 目录。

datasoft@datasoft-linux:/etc$ ls /etc | more
acpi
adduser.conf
alternatives
anacrontab
apg.conf
apm
apparmor
apparmor.d
apport
apt
aptdaemon
at-spi2
avahi
bash.bashrc
bash_completion
bash_completion.d
bindresvport.blacklist
blkid.conf
blkid.tab
bluetooth
brlapi.key
brltty
brltty.conf
--More--

文件 /etc/sysconfig/firstboot 告诉 Red Hat 安装代理不要在引导时运行。如果您想在下次重新启动时运行 Red Hat 安装代理,只需删除该文件,然后运行 ​​chkconfig --level 5 firstboot on 即可。 Red Hat 安装代理允许您安装最新更新、创建用户帐户、加入红帽网络等。然后它将再次创建 /etc/sysconfig/firstboot 文件。

/etc/sysconfig/harddisks 文件包含一些用于调整硬盘的参数。该文件本身就解释了这一点。

您可以在/etc/sysconfig/hwconf中看到kudzu检测到的硬件。 Kudzu 是 Red Hat 的软件,用于自动发现和配置硬件。

键盘类型和键映射表在 /etc/sysconfig/keyboard 文件中设置。有关更多控制台键盘信息,请查看 keymaps(5)、dumpkeys(1)、loadkeys(1) 和目录 /lib/kbd/keymaps/ 的手册页。

我们将在网络章节中讨论此目录中的网络文件。

数据目录

/家

这里存储用户的主目录,用户可以在/home下存储个人或项目数据。通常(但 fhs 不强制)做法是以 /home/ $USERNAME 格式在用户名之后命名用户主目录。例如:

datasoft@datasoft-linux:/$ ls /home
datasoft

除了为每个用户(或每个项目或组)提供一个存储个人文件的位置之外,用户的主目录还可以用作存储用户配置文件的位置。典型的 Unix 用户配置文件包含许多隐藏文件(文件名以点开头的文件)。 Unix 用户配置文件的隐藏文件包含特定于该用户的设置。

/根

在许多系统上,/root 是 root 用户的个人数据和配置文件的默认位置。如果默认情况下不存在,则某些管理员会创建它。

/srv

您可以将 /srv 用于系统提供的数据。 FHS 允许在此位置定位 cvs、rsync、ftp 和 www 数据。 FHS 还批准 / srv 中的管理命名,例如 /srv/project55/ftp 和 /srv/sales/www。

在 Sun Solaris(或 Oracle Solaris)上,/export 用于此目的。

/媒体

/media 目录用作可移动媒体设备(例如 CDROM、数码相机和各种 USB 连接设备)的安装点。由于 /media 在 Unix 世界中相当新,因此您很可能会遇到没有此目录而运行的系统。 Solaris 9 没有它,Solaris 10 有。目前大多数 Linux 发行版都将所有可移动媒体安装在 /media 中。

datasoft@datasoft-linux:/$ ls /home
datasoft

/mnt

/mnt 目录应该为空,并且只能用于临时安装点(根据 FHS)。

Unix 和 Linux 管理员过去常常在这里创建许多目录,例如 /mnt/something/。您可能会遇到许多系统,其中在 /mnt 内创建和/或安装了多个目录,以用于各种本地和远程文件系统。

/tmp

应用程序和用户应在需要时使用 /tmp 来存储临时数据。 /tmp 中存储的数据可以使用磁盘空间或 RAM。两者都由操作系统管理。切勿使用 /tmp 来存储重要或您希望存档的数据。

在内存目录中

/dev

/dev 中的设备文件看似普通文件,但实际上并不位于硬盘上。当内核识别硬件时,/dev 目录中会填充文件。

常见物理设备

硬盘设备等常见硬件由/dev 中的设备文件表示。下面是笔记本电脑上的 SATA 设备文件和台式机上的 IDE 连接驱动器的屏幕截图。 (这些设备的详细含义将在后面讨论。)

datasoft@datasoft-linux:/$ ls /dev/sd*
/dev/sda   /dev/sda10  /dev/sda5  /dev/sda7  /dev/sda9
/dev/sda1  /dev/sda2   /dev/sda6  /dev/sda8

除了代表物理硬件之外,一些设备文件也很特殊。这些特殊设备非常有用。

/dev/tty 和 /dev/pts

例如,/dev/tty1 表示连接到系统的终端或控制台。 (不要对“终端”或“控制台”的确切术语感到困惑,我们这里指的是命令行界面。)在属于 Gnome 或 KDE 等图形界面一部分的终端中键入命令时,然后您的终端将表示为 /dev/pts/1 (1 可以是另一个数字)。

/dev/空

在 Linux 上,您会发现其他特殊设备,例如 /dev/null,它可以被视为黑洞;它具有无限的存储空间,但无法从中检索任何内容。从技术上讲,写入 /dev/null 的任何内容都将被丢弃。 /dev/null 可用于丢弃命令中不需要的输出。 /dev/null 不是存储备份的好位置;-)。

/proc 与内核的对话

/proc是另一个特殊目录,看似普通文件,但不占用磁盘空间。它实际上是内核的视图,或者更好地说,是内核管理的内容的视图,并且是与其直接交互的一种手段。 /proc 是一个 proc 文件系统。

datasoft@datasoft-linux:/$ mount -t proc
proc on /proc type proc (rw,noexec,nosuid,nodev)

列出 /proc 目录时,您将看到许多数字(在任何 Unix 上)和一些有趣的文件(在 Linux 上)

datasoft@datasoft-linux:/$ ls /proc
1     1632  19    2195  34   751        cpuinfo        mounts
10    1635  1901  22    346  754        crypto         mtrr
1014  1643  1904  2201  35   761        devices        net
1063  1647  1909  2202  36   78         diskstats      pagetypeinfo
11    1656  1927  2261  37   79         dma            partitions
1107  1660  1931  2272  417  8          driver         sched_debug
1130  1664  1935  23    481  80         execdomains    schedstat
12    1667  1949  2302  49   802        fb             scsi
13    1686  1954  2308  495  846        filesystems    self
1323  1695  1958  2315  5    885        fs             slabinfo
136   17    1962  2324  50   888        interrupts     softirqs
137   1709  1977  24    52   889        iomem          stat
1498  1710  2     2481  53   896        ioports        swaps
15    1712  20    25    54   9          ipmi           sys
1500  1714  2012  2503  55   949        irq            sysrq-trigger
1563  1723  2057  2551  565  954        kallsyms       sysvipc
1571  1724  2067  26    577  957        kcore          timer_list
1580  1725  2082  27    592  975        key-users      timer_stats
1586  1730  2090  2726  596  984        kmsg           tty
1598  1744  21    276   597  986        kpagecount     uptime
16    1760  2105  28    618  995        kpageflags     version
1614  1772  2110  282   638  acpi       latency_stats  version_signature
1618  1794  2117  29    671  asound     loadavg        vmallocinfo
1622  18    2129  3     679  buddyinfo  locks          vmstat
1623  1804  2143  31    7    bus        mdstat         zoneinfo
1625  1813  2152  319   740  cgroups    meminfo
1626  1818  2159  32    744  cmdline    misc
1631  1898  2182  33    750  consoles   modules

让我们研究一下 /proc 内的文件属性。查看日期和时间将显示当前日期和时间,显示文件不断更新(内核视图)。

datasoft@datasoft-linux:/$ date
Wed Jul 30 16:13:52 IST 2014
datasoft@datasoft-linux:/$ ls -al /proc/cpuinfo
-r--r--r-- 1 root root 0 Jul 30 16:14 /proc/cpuinfo
datasoft@datasoft-linux:/$ 
datasoft@datasoft-linux:~$ date
Wed Jul 30 17:28:27 IST 2014
datasoft@datasoft-linux:~$ ls -al /proc/cpuinfo
-r--r--r-- 1 root root 0 Jul 30 17:28 /proc/cpuinfo

/proc 中的大多数文件都是 0 字节,但它们包含数据——有时包含大量数据。您可以通过在 /proc/cpuinfo 等文件上执行 cat 来查看这一点,其中包含有关 CPU 的信息。

datasoft@datasoft-linux:~$ file /proc/cpuinfo
/proc/cpuinfo: empty 
datasoft@datasoft-linux:~$ cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Pentium(R) CPU G620 @ 2.60GHz
stepping	: 7
microcode	: 0x25
cpu MHz		: 1600.000
cache size	: 3072 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5188.25
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Pentium(R) CPU G620 @ 2.60GHz
stepping	: 7
microcode	: 0x25
cpu MHz		: 1600.000
cache size	: 3072 KB
physical id	: 0
siblings	: 2
core id		: 1
cpu cores	: 2
apicid		: 2
initial apicid	: 2
fdiv_bug	: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5188.25
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

datasoft@datasoft-linux:~$

只是为了好玩,这里是 Sun Sunblade 1000 上的 /proc/cpuinfo...

datasoft@datasoft-linux:~$ cat /proc/cpuinfo | more
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Pentium(R) CPU G620 @ 2.60GHz
stepping	: 7
microcode	: 0x25
cpu MHz		: 1600.000
cache size	: 3072 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
--More--

/proc 中的大多数文件是只读的,有些需要 root 权限,有些文件是可写的,而 /proc/sys 中的许多文件是可写的。让我们讨论 /proc 中的一些文件。

/proc/中断

在 x86 架构上,/proc/interrupts 显示中断。

datasoft@datasoft-linux:~$ cat /proc/interrupts
           CPU0       CPU1       
  0:         16          0   IO-APIC-edge      timer
  1:          2          0   IO-APIC-edge      i8042
  7:          0          0   IO-APIC-edge      parport0
  8:          1          0   IO-APIC-edge      rtc0
  9:          3          0   IO-APIC-fasteoi   acpi
 12:          4          0   IO-APIC-edge      i8042
 16:         29          0   IO-APIC-fasteoi   ehci_hcd:usb1
 19:      17283      26337   IO-APIC-fasteoi   ata_piix, ata_piix
 23:      55734      64589   IO-APIC-fasteoi   ehci_hcd:usb2
 40:         13          0   PCI-MSI-edge      mei_me
 41:     500032          0   PCI-MSI-edge      i915
 42:        470          0   PCI-MSI-edge      snd_hda_intel
 43:      43010          0   PCI-MSI-edge      eth0
NMI:         24         26   Non-maskable interrupts
LOC:     359598     369234   Local timer interrupts
SPU:          0          0   Spurious interrupts
PMI:         24         26   Performance monitoring interrupts
IWI:       9565      11827   IRQ work interrupts
RTR:          0          0   APIC ICR read retries
RES:     101165      71652   Rescheduling interrupts
CAL:        202        596   Function call interrupts
TLB:       3370       6154   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:         42         42   Machine check polls
ERR:          0
MIS:          0

在具有两个 CPU 的机器上,该文件如下所示。

datasoft@datasoft-linux:~$ cat /proc/interrupts
           CPU0       CPU1       
  0:         16          0   IO-APIC-edge      timer
  1:          2          0   IO-APIC-edge      i8042
  7:          0          0   IO-APIC-edge      parport0
  8:          1          0   IO-APIC-edge      rtc0
  9:          3          0   IO-APIC-fasteoi   acpi
 12:          4          0   IO-APIC-edge      i8042
 16:         29          0   IO-APIC-fasteoi   ehci_hcd:usb1
 19:      17283      26337   IO-APIC-fasteoi   ata_piix, ata_piix
 23:      55734      64589   IO-APIC-fasteoi   ehci_hcd:usb2
 40:         13          0   PCI-MSI-edge      mei_me
 41:     500032          0   PCI-MSI-edge      i915
 42:        470          0   PCI-MSI-edge      snd_hda_intel
 43:      43010          0   PCI-MSI-edge      eth0
NMI:         24         26   Non-maskable interrupts
LOC:     359598     369234   Local timer interrupts
SPU:          0          0   Spurious interrupts
PMI:         24         26   Performance monitoring interrupts
IWI:       9565      11827   IRQ work interrupts
RTR:          0          0   APIC ICR read retries
RES:     101165      71652   Rescheduling interrupts
CAL:        202        596   Function call interrupts
TLB:       3370       6154   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:         42         42   Machine check polls
ERR:          0

/proc/kcore

物理内存在 /proc/kcore 中表示。不要尝试cat这个文件,而是使用调试器。 /proc/kcore 的大小与你的物理内存相同,加上四个字节。

datasoft@datasoft-linux:~$ ls -lh /proc/kcore
-r-------- 1 root root 1020M Jul 30 17:41 /proc/kcore
datasoft@datasoft-linux:~$ 

/sys Linux 2.6 热插拔

/sys 目录是为 Linux 2.6 内核创建的。从2.6开始,Linux使用sysfs来支持usb和IEEE 1394(FireWire)热插拔设备。有关详细信息,请参阅 udev(8)(devfs 的后继者)和 hotplug(8) 的手册页(或访问 http://linuxhotplug.sourceforge.net/ )。

基本上 /sys 目录包含有关硬件的内核信息。

/usr Unix 系统资源

尽管 /usr 的发音与 user 类似,但请记住它代表 Unix 系统资源。 /usr 层次结构应包含可共享的只读数据。有些人选择将 /usr 挂载为只读。这可以从其自己的分区或只读 NFS 共享来完成。

/usr/bin

/usr/bin 目录包含很多命令。

datasoft@datasoft-linux:~$ ls /usr/bin | wc -l
1421

/usr/包括

/usr/include 目录包含 C 的通用包含文件。

datasoft@datasoft-linux:~$ ls /usr/include/
aio.h          fcntl.h         math.h           pwd.h          sysexits.h
aliases.h      features.h      mcheck.h         python2.7      syslog.h
alloca.h       fenv.h          memory.h         rdma           tar.h
argp.h         fmtmsg.h        mntent.h         re_comp.h      termio.h
argz.h         fnmatch.h       monetary.h       regex.h        termios.h
ar.h           fstab.h         mqueue.h         regexp.h       tgmath.h
arpa           fts.h           mtd              resolv.h       thread_db.h
asm-generic    ftw.h           nautilus-sendto  rpc            time.h
assert.h       _G_config.h     net              rpcsvc         ttyent.h
...

/usr/lib

/usr/lib 目录包含不由用户或脚本直接执行的库。

datasoft@datasoft-linux:~$ ls /usr/lib | head -7
2013.com.canonical.certification:checkbox
2013.com.canonical.certification:plainbox-resources
accountsservice
aisleriot
apg
apt
aspell

/usr/本地

管理员可以使用 /usr/local 目录在本地安装软件。

datasoft@datasoft-linux:~$ ls /usr/local/
bin  etc  games  include  lib  man  sbin  share  src
datasoft@datasoft-linux:~$ du -sh /usr/local
11M	/usr/local

/usr/共享

/usr/share 目录包含与体系结构无关的数据。正如您所看到的,这是一个相当大的目录。

datasoft@datasoft-linux:~$ ls /usr/share/ | wc -l
283
datasoft@datasoft-linux:~$ du -sh /usr/share/
1.1G	/usr/share/

此目录通常包含用于手册页的 /usr/share/man。

datasoft@datasoft-linux:~$ ls /usr/share/man
ar   ca@valencia  en_GB  fr            hr  ko    man5  nb  pt_BR  sq  uk
ast  cs           eo     fr.ISO8859-1  hu  ku    man6  nl  ro     sr  uz
be   cy           es     fr.UTF-8      id  lt    man7  nn  ru     sv  vi
bg   da           et     fy            io  lv    man8  oc  se     ta  zh_CN
bn   de           eu     gd            it  man1  mhr   pa  shn    te  zh_HK
bo   el           fa     gl            ja  man2  ml    pl  si     th  zh_TW
bs   en_AU        fi     he            kk  man3  ms    ps  sk     tr
ca   en_CA        fo     hi            km  man4  my    pt  sl     ug

它包含所有静态游戏数据的 /usr/share/games (因此没有高分或游戏日志)。

datasoft@datasoft-linux:~$ ls /usr/share/games/
ls: cannot access /usr/share/games/: No such file or directory

/usr/src 目录

/usr/src 目录是内核源文件的推荐位置。

datasoft@datasoft-linux:~$ ls -l /usr/src/
total 8
drwxr-xr-x 24 root root 4096 Apr 17 06:54 linux-headers-3.13.0-24
drwxr-xr-x  7 root root 4096 Apr 17 06:55 linux-headers-3.13.0-24-generic

/var 变量数据

大小不可预测的文件(例如日志、缓存和假脱机文件)应位于 /var 中。

/var/日志

/var/log 目录作为包含所有日志文件的中心点。

datasoft@datasoft-linux:~$ ls /var/log
alternatives.log  dist-upgrade    fsck               syslog
apport.log        dmesg           gpu-manager.log    syslog.1
apport.log.1      dmesg.0         hp                 syslog.2.gz
apport.log.2.gz   dmesg.1.gz      installer          udev
apt               dmesg.2.gz      kern.log           unattended-upgrades
auth.log          dmesg.3.gz      lastlog            upstart
boot.log          dmesg.4.gz      lightdm            wtmp
bootstrap.log     dpkg.log        pm-powersave.log   Xorg.0.log
btmp              faillog         samba              Xorg.0.log.old
cups              fontconfig.log  speech-dispatcher

版权所属:SO JSON在线解析

原文地址:https://www.sojson.com/blog/520.html

转载时必须以链接形式注明原始出处及本声明。

本文主题:

如果本文对你有帮助,那么请你赞助我,让我更有激情的写下去,帮助更多的人。

关于作者
一个低调而闷骚的男人。
相关文章
JSON文件如何转换为txt文件
Java有序读取配置文件,有序读取ini配置文件
Java对文件CRC32值计算
Elasticsearch教程,Elasticsearch配置文件 — elasticsearch.yml
Linux 安装 Redis 详细步骤讲解
Linux Centos 使用 Redis service 启动,Redis service 脚本编写
阿里云Linux、代理Squid服务安装,高匿、用户/密码校验配置
Shiro教程,Shiro 配置文件详细解释,Shiro自定义Filter配置
Shiro教程(六)Shiro整体的配置文件
如何处理大体积 XLSX/CSV/TXT 文件
最新文章
JavaScript对象详细剖析 0
Python print() 函数 80
PHP if/else/elseif 语句 88
HTML5 Canvas弧线教程 103
Java赋值运算符 118
XML内部实体和外部实体 217
Java面向对象编程概念 177
PHP回显语句 128
Linux—文件树 156
C语言while循环和do while循环 155
最热文章
最新MyEclipse8.5注册码,有效期到2020年 (已经更新) 683032
苹果电脑Mac怎么恢复出厂系统?苹果系统怎么重装系统? 674756
免费天气API,全国天气 JSON API接口,可以获取五天的天气预报 603327
免费天气API,天气JSON API,不限次数获取十五天的天气预报 582453
Jackson 时间格式化,时间注解 @JsonFormat 用法、时差问题说明 553196
我为什么要选择RabbitMQ ,RabbitMQ简介,各种MQ选型对比 509482
Elasticsearch教程(四) elasticsearch head 插件安装和使用 480123
Jackson 美化输出JSON,优雅的输出JSON数据,格式化输出JSON数据... ... 265195
Java 信任所有SSL证书,HTTPS请求抛错,忽略证书请求完美解决 244332
Elasticsearch教程(一),全程直播(小白级别) 225702
支付扫码

所有赞助/开支都讲公开明细,用于网站维护:赞助名单查看

查看我的收藏

正在加载... ...