linux系统目录结构

简介:

绝对路径:从/(根)开始的为绝对路径

[root@localhost ~]# cd /etc

相对路径:不从/(根)开始的为相对路径

[root@localhost etc]# cd httpd/

Linux系统目录结构

[root@localhost ~]# tree -L 1 /

/

├── bin------->(Essential user command binaries(for use by all users)),常用二进制命令所在的目录。比如ls、cp、mkdir、rm、cut等命令;/bin目录和/usr/bin类似

Command Description

cat------->concatenate files to standard output

chgrp------->change file group ownership

chmod------->change file access permissions

chown------->change file owner and group

cp------->copy files and directories

date------->print or set the system data and time

dd------->convert and copy a file

df------->report filesystem disk space usage

dmesg------->print or control the kernel message buffer

echo ------->display a line of text

false------->do nothing, unsuccessfully

hostname------->show or set the system's host name

kill-------> send signals to processes

In------->make links between files

login------->begin a session on the system

ls------->list directory contents

mkdir------->make directories

mknod------->make block or character special files

more------->page through text

mount------->mount a filesystem

mv------->move/rename files

ps------->report process status

pwd------->print name of current working diretory

rm------->remove files or directories

rmdir------->remove empty directories

sed------->The 'sed' stream editor

sh------->The Bourne command shell

stty------->change and print termainal line settings

su------->change user ID

sync------->flush filesystem buffers

true------->do nothing, successfull

umount------->unmount file systems

uname------->print system information

├── boot------->(Static files of the boot loader)Linux的内核及引导系统程序所需的文件目录。安装系统分区的时候一般要分一个bott分区。常见分区:/boot 128Mswap内存的1.5倍/全给

├── dev------->(Device files)设备文件的目录,比如声卡、磁盘、光驱......./dev/null黑洞目录

├── etc------->(Host-specific system configuretion)

(1)二进制安装包(yum,rpm)的配置文件默认路径

Directory Description

exports------->NFS filesystem access control list(optional)

fstab------->Static information about filesystems(optional)

hosts------->Static information about host names(optional)

inittab------->Configuretion file for init(optional)

issue------->Pre-login message and identification file(optional)

ld.so.conf------->List of extra directories to search for shared libraries(iptional)

motd------->Post-login message of the day file(optional)

networks------->Static information about network names(optional)

passwd------->The password file(optional)

profile------->Systemwide initialization file for sh shell logins(optional)

resolv.conf------->Resolver configuration file(optional)

services------->Port names for network services(optional)

syslog.conf------->Configuration file for syslogd(optional)

(2)服务启动命令存放目录/etc/init.d/(yum,rpm)

├── home------->(User home directories(opeional))普通用户的家目录默认数据存放目录

├── lib------->(Essential shared libraries and kernel modules)库文件存放目录

├── lib64

├── lost+found------->在ext3文件系统中,当系统意外崩溃或机器意外关机,会产生一些文件碎片在这里。当系统在开机启动的过程中fsck工具会检查这里,并修复已经损坏的文件系统。当系统发生问题,可能会有文件被移到这个目录中,可能需要用手工的方式来修复,或移动文件到原来的位置上

├── media------->一般是用于临时挂载目录,比如媒体、U盘、光驱等。与/mnt一样

├── mnt------->(Mount point for mounting a filesystem temporarily)一般是用于临时挂载存储设备的挂载目录的,比如有cdrom,u盘等目录。直接插入光驱无法使用,要先挂载后才能使用

├── opt(optional)------->Oracle数据库安装路径可以指定安装到/opt目录下,其他软件安装路径也可以指定此目录

├── proc------->(Kernel and process information virtual filesystem)操作系统运行时,进程信息及内核信息(比如cpu、硬盘分区、内存信息等)存放在这里。/proc目录伪装的文件系统proc的挂载目录,proc并不是真正的文件系统,它的定义可以参见/etc/fstab

├── root------->(Home directory for the root user(optional)Linux超级管理员用户root的家目录;windows管理员administrator

├── sbin------->(Essential system binaries)大多是涉及系统管理的命令的存放,是超级权限用户root的可执行命令存放目录,这个目录和/usr/sbin;/usr/X11R6/sbin或/usr/local/sbin目录是相似的;

Command Description

fdisk------->Partition table manipulator(optional)

fsck------->File system check and repair utility(optional)

halt------->Command to stop the system(optional)

ifconfig------->Configure a network interface(optional)

init------->Initial process(optional)

mkfs------->Command to build a filesystem(optiona)

mkfs.*------->Command to build a specific filesystem(optional)

mkfsswap------->Command to set up a swap area(optional)

reboot------->Command to reboot the system(optional)

route------->IP routing table utility(optional)

swapon------->Enable paging and swapping(optional)

swapoff------->Disable paging and swapping(optional)

Linux systems place these additional files into /sbin

Second extended filesystem commands(optional)

badblocks

dumpe2fs

e2fsck

mke2fs

mklost+found

tune2fs

特别提示:对于5.X的系统,直接ifconfig是无法出结果的

├── selinux

├── srv

├── sys

├── tmp------->(Temporary files)临时文件目录,有时用户运行程序的时候,会产生临时文件。/tmp就用来存放临时文件的,权限比较特殊。/var/tmp目录和这个目录相似

├── usr------->(secondary hierarchy)这个就是系统存放程序的目录,比如命令、帮助文件等。这个目录下有很多的文件和目录。当我们安装一个Linux发行版官方提供的软件包时,大多安装在这里

如果有涉及服务器配置文件的,会把配置文件安装在/etc目录中

Directory Description

/usr/bin------->Most user commands用户可执行文件目录

/usr/include------->Header files included by C programs程序的头文件存放目录

/usr/lib------->Libraries

/usr/local------->Local hierarchy(empty after main installation)

/usr/local/sbin

/usr/local/bin

/usr/sbin------->Non-vital system binaries

/usr/share------->Architecture-independent data

/usr/share/fonts------->字体目录

/usr/share/man------->帮助目录

/usr/share/doc------->文档目录

/usr/src------->Source code(optional)<---源码目录

└── var------->(Variable data)这个目录的内容是经常变动的,看名字就知道啦,我们可以理解为vary的缩写,/var下有/var/log这是用来存放系统日志的目录,系统日志路径/var/log/messages。/var/www/目录是定义Apache服务器站点存放目录;/var/lib用来存放一些库文件,比如mysql的以及mysql数据库的存放点

DirectoryDescription

/var/cache------->Application cache data

/var/lib------->Variable state information

/var/local------->Variable data for /usr/local

/var/lock------->Lock files

/var/log------->Log files and directories

/var/log/lastlog------->record of last login of each user

/var/log/messages------->system messages from syslogd(系统日志文件)

/var/log/secure------->system secure messages

/var/log/wtmp------->record of all logins and logouts

/var/opt------->Variable data for /opt

/var/run------->Data relevant to running processes

------->Run-time variable data

/var/spool------->Application spool data

/var/spool/cron------->cron and at jobs(定时任务的配置文件路径)

This directory contaions the variable data for the cron and at programs.

/var/tmp------->Temporary files preserved between system reboots

必须掌握的linux目录路径知识

目录说明

/etc/sysconfig/network-scripts/ifcfg-eth0------->配置网络地址及网关等;/etc/init.d/network restart重启网卡 start启动网卡 stop停止网卡

/etc/resolv.conf            ------->设置linux本地客户端DNS的文件,DNS可以实现域名和IP地址绑定

/etc/hosts            ------->设定用户IP与名字(或域名)的对应解析表,相当于本地LAN内DNS(类似于C:\WINDOWS\system32\drivers\etc\hosts LAN内IP域名解析文件)

/etc/fstab            ------->记录开机要mount的文件系统的一个文件

/etc/rc.local            ------->存放开机自启动程序命令的文件(类似于chkconfig命令)

/etc/inittab            ------->设定系统启动时init进程将把系统设置成什么样的runlevel及加载想着的启动文件设置

/etc/exports            ------->设定NFS网络文件系统用的配置文件

/etc/init.d            ------->这个目录是用来存放系统或服务器以 System V模式启动的脚本,这在以System V模式启动或初始化的系统中常见

/etc/xinit.d            ------->如果服务器是通过xinetd模式运行的,它的脚本要放在这个目录下。有些系统没有这个目录,比如 Slackware,有些老的版本

/etc/profile            ------->系统全局环境变量配置路径

/etc/profile.d            ------>加载系统登录程序一个目录,命令或文件独立存在

/etc/issue------->系统及内核版本号

/etc/motd------->登录提醒

/etc/group------->设定用户的组名与想着信息

/etc/passwd------->账号信息文件

/etc/shadow------->密码信息文件

/etc/sudoers------->可以执行使用sudo命令的配置文件(权限提升)

/etc/securetty------->设定哪些终端可以让root登录

/etc/login.defs------->所有用户登录时缺少配置

/etc/modprobe.conf------->内核模块额外参数设定

/etc/syslog.conf------->日志设置文件,限Centos5.X

/etc/rsyslog.conf------->日志设置文件,限Centos6.X

/etc/rc.locad------->存放开启自启动内容的文件


/var 目录下路径知识

目录说明

/var------->可变化的日志文件

/var/log------->各种系统日志文件存放目录

/var/log/messages------->系统信息默认日志文件,非常重要,按周自动轮询

/var/log/secure------->记录倒入系统存取信息的文件,按周自动轮询,例如pop3,ssh,telnet,ftp等都会记录在此。系统安全的日志文件

/var/log/wtmp------->记录登陆者信息的文件,last、lastlog

/var/spool------->存放mail、crond

/var/spool/cron/root------->记定时任务crontab默认路径,按用户全名的文件

/var/spool/mail------->存放用户邮件的目录


/proc 目录下路径知识

目录说明

/proc------->虚拟目录,是内存的映射,内核和进程的虚拟文件系统目录

/proc/version------->内核版本

/proc/sys/kernel------->系统内核功能

/proc/sys/net/ipv4------->修改proc的配置时临时生效。/etc/sysctl.conf内核参数里配置才是永久生效。两个路径的修改效果是一样的

/proc/cpuinfo------->关于处理器的信息,如类型、厂家、型号和性能等

/proc/meminfo------->系统内存信息

/proc/devices ------->当前运行内核所配置的所有设备清单

/proc/dma   ------->当前正在使用的AMD通道

/proc/filesystems------->当前运行内核所配置的文件系统

/proc/interrupts------->正在使用的中断,和曾经有多少个中断

/proc/ioports------->当前正在使用的I/O端口

/proc/loadavg------->系统负载平均值信息(系统的繁忙情况,比较准确,但是不够细致系统性能指标),uptime的结果,值不要超过CPU的核楼




本文转自 小杨_Ivan 51CTO博客,原文链接:http://blog.51cto.com/aqiang/1891968
相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
相关文章
|
5天前
|
Ubuntu 安全 Linux
《Linux 简易速速上手小册》第1章: Linux 系统基础(2024 最新版)
《Linux 简易速速上手小册》第1章: Linux 系统基础(2024 最新版)
38 1
|
13天前
|
资源调度 JavaScript 搜索推荐
Linux系统之部署envlinks极简个人导航页
【4月更文挑战第11天】Linux系统之部署envlinks极简个人导航页
52 2
|
15天前
|
缓存 Linux 测试技术
安装【银河麒麟V10】linux系统--并挂载镜像
安装【银河麒麟V10】linux系统--并挂载镜像
78 0
|
15天前
|
监控 Unix Linux
Linux操作系统调优相关工具(四)查看Network运行状态 和系统整体运行状态
Linux操作系统调优相关工具(四)查看Network运行状态 和系统整体运行状态
30 0
|
22天前
|
存储 前端开发 Linux
Linux系统之部署ToDoList任务管理工具
【4月更文挑战第1天】Linux系统之部署ToDoList任务管理工具
63 1
|
13天前
|
存储 算法 Linux
【实战项目】网络编程:在Linux环境下基于opencv和socket的人脸识别系统--C++实现
【实战项目】网络编程:在Linux环境下基于opencv和socket的人脸识别系统--C++实现
37 6
|
1天前
|
监控 安全 Linux
Linux系统之安装ServerBee服务器监控工具
【4月更文挑战第22天】Linux系统之安装ServerBee服务器监控工具
37 2
|
1天前
|
缓存 Linux
linux系统缓存机制
linux系统缓存机制
|
2天前
|
存储 Linux Android开发
RK3568 Android/Linux 系统动态更换 U-Boot/Kernel Logo
RK3568 Android/Linux 系统动态更换 U-Boot/Kernel Logo
16 0
|
2天前
|
Linux 开发工具 Android开发
Docker系列(1)安装Linux系统编译Android源码
Docker系列(1)安装Linux系统编译Android源码
4 0