您是否想知道为什么某些程序位于/ bin,/ sbin,/ usr / bin或/ usr / sbin下?
例如,less命令位于/ usr / bin目录下。为什么不使用/ bin或/ sbin或/ usr / sbin?这些目录之间有什么区别?
在本文中,让我们回顾一下Linux文件系统结构并了解各个高级目录的含义。
1. /– Root
- Every single file and directory starts from the 根 directory.
- Only 根 用户 has write privilege under this directory.
- Please note that /root is 根 用户’s home directory, 这是 not same as /.
2. / bin– User Binaries
- 包含二进制可执行文件。
- 您需要在单用户模式下使用的常见Linux命令位于此目录下。
- Commands used 通过 all the 用户s of the system are located here.
- 例如:ps,ls,ping,grep,cp。
3. / sbin– System Binaries
- 就像/ bin一样,/ sbin也包含二进制可执行文件。
- 但是,位于该目录下的linux命令通常由系统管理员用于系统维护目的。
- 例如:iptables,重新启动,fdisk,ifconfig,swapon
4. / etc– Configuration Files
- 包含所有程序所需的配置文件。
- 它还包含用于启动/停止单个程序的启动和关闭Shell脚本。
- 例如:/etc/resolv.conf、/etc/logrotate.conf
5. / dev– Device Files
- 包含设备文件。
- These include terminal devices, usb, or any device attached to the 系统。
- 例如:/ dev / tty1,/ dev / usbmon0
6. / proc– Process Information
- 包含有关系统进程的信息。
- 这是一个伪文件系统,包含有关运行进程的信息。例如:/ proc / {pid}目录包含有关具有该特定pid的进程的信息。
- 这是一个虚拟文件系统,其中包含有关系统资源的文本信息。例如:/ proc / uptime
7. / var– Variable Files
- var代表变量文件。
- 可在此目录下找到预期增长的文件的内容。
- 这包括—系统日志文件(/ var / log);软件包和数据库文件(/ var / lib);电子邮件(/ var / mail);打印队列(/ var / spool);锁定文件(/ var / lock);重启后需要临时文件(/ var / tmp);
8. / tmp– Temporary Files
- Directory that contains temporary files created 通过 system and 用户s.
- 重新启动系统后,该目录下的文件将被删除。
9. / usr – 用户程序
- 包含二进制文件,库,文档和第二级程序的源代码。
- / usr/bin contains binary files for 用户 programs. If you can’t find a 用户 binary under /bin, look under / usr/bin. For example: at, awk, cc, less, scp
- / usr / sbin包含系统管理员的二进制文件。如果你可以的话’t find a system binary under /sbin, look under / usr/sbin. For example: atd, cron, sshd, 用户add, 用户del
- / usr/lib contains libraries for / usr/bin and / usr/sbin
- / usr/local contains 用户s programs that you install from source. For example, when you install apache from source, it goes under / usr/local/apache2
10. / home– 首页 Directories
- 首页 directories for all 用户s to store their personal files.
- 例如:/ home / john,/ home / nikita
11. /启动– Boot Loader Files
- 包含与引导加载程序相关的文件。
- 内核initrd,vmlinux,grub文件位于/ boot下
- 例如:initrd.img-2.6.32-24-generic,vmlinuz-2.6.32-24-generic
12. / lib– System Libraries
- 包含支持位于/ bin和/ sbin下的二进制文件的库文件
- 库文件名是ld *或lib * .so。*
- 例如:ld-2.11.1.so,libncurses.so.5.7
13. /选择 –可选的附加应用程序
- opt代表可选。
- 包含来自各个供应商的附加应用程序。
- 附加应用程序应安装在/ opt /或/ opt /子目录下。
14. / mnt– Mount Directory
- sysadmin可以在其中挂载文件系统的临时挂载目录。
15. / media–可移动媒体设备
- 可移动设备的临时安装目录。
- 例如,用于CD-ROM的/ media / cdrom; / media / floppy用于软盘驱动器; CD刻录机的/ media / cdrecorder
16. / srv– Service Data
- srv代表服务。
- 包含服务器特定的服务相关数据。
- 例如,/ srv / cvs包含与CVS相关的数据。
如果您喜欢这篇文章,您可能还会喜欢..
![]() |
![]() |
![]() |
![]() |
完善!!!现在是时候让某人这样做!