1:  网卡的配置文件

[

root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0  #网卡设备名称HWADDR=00:0C:29:26:96:BD  #MAC地址
TYPE=Ethernet  #以太网
UUID=e982e20a-e7ef-4246-8e44-a7c0c474c708  #Linux系统内部的标识,唯一
ONBOOT=yes  #开机启动
NM_CONTROLLED=yes  
#BOOTPROTO=dhclient
BOOTPROTO=static  #引导协议,一般为static(静态),dhclient(自动获取)
IPADDR=192.168.126.128  #IP地址
NETMASK=255.255.255.0  #子网掩码
GATEWAY=192.168.126.2  #网关
DNS=111.13.148.14

同样可以使用命令setup来执行网卡参数

2:  DNS文件

[root@localhost ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search localdomain
nameserver 192.168.126.2

注:网卡的配置文件里面如果配置了DNS,它的优先级是高于这个配置文件的。

3:  hosts文件

/etc/hosts  用户IP与名称(域名)的对应解析的配置文件

在实际的生产环境中很有用(一般所有的内网机器hosts文件都保持一致),主要用于服务器迁移

[root@centos6 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.197.100 centos6.6
[root@centos6 ~]# hostname
centos6.6
[root@centos6 ~]# ping centos6.6
PING centos6.6 (192.168.197.100) 56(84) bytes of data.
64 bytes from centos6.6 (192.168.197.100): icmp_seq=1 ttl=64 time=0.051 ms
64 bytes from centos6.6 (192.168.197.100): icmp_seq=2 ttl=64 time=0.047 ms
64 bytes from centos6.6 (192.168.197.100): icmp_seq=3 ttl=64 time=0.047 ms
^C
-- centos6.6 ping statistics --
3 packets transmitted, 3 received, 0% packet loss, time 2867ms
rtt min/avg/max/mdev = 0.047/0.048/0.051/0.006 ms

实际生产环境的作用:

  1.  开发、产品、测试人员用于通过正式的域名来测试产品

  2.  服务器之间调用可以用域名,方便以后的迁移(各程序之间调用域名,机房迁移之后只需修改相应的hosts文件即可)

4:  主机名文件

/etc/sysconfig/network  修改机器名及网卡启动、网关配置文件

修改上述的HOSTNAME永久生效(修改主机名)

5:  fstab文件

/etc/fstab  记录开机要挂载的文件系统文件

开机自动挂载磁盘,设置文件系统挂载信息的文件

文件信息一共包含六列(具体解析可 man fstab 查看)

第一列:  被挂载的设备名称

第二列:  挂载点位置

第三列:  文件系统类型

第四列:  挂载选项(只读、可写、其他等等)

第五列:  需不需要备份(0就是不备份)

第六列:  需不需要开机检查(0就是不需要,需要设置为1)

6:  /etc/rc.local文件

存放开机自启动服务命令(同于windows里面的开始菜单中启动菜单)

可以将命令直接写入到配置文件的末行

注:  实际生产环境中,一般服务开机自启动都会写入这个配置文件里面,这样只需要查看此配置文件就可以得知服务器运行哪些服务。

7:  inittab文件

/etc/inittab  设定系统启动时init进程将把系统设置成什么样的运行级别及加相关的启动文件配置的文件

[root@localhost ~]# cat /etc/inittab
# inittab is only used by upstart for the default runlevel.  #只被用于突然发起的默认运行级别
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:

注:  linux开机启动流程如下:

开机自检----MBR引导程序-----GRUB菜单----加载内核----运行init进程----读取/etc/inittab配置文件----执行/etc/rc.d/rc.sysinit脚本----执行/etc/rc.local脚本(读取运行级别)----启动终端登录进程----登录系统

8:  软件启动服务文件

/etc/init.d  安装的软件启动服务(系统的启动服务)所在目录

使用yum、rpm安装的软件启动程序都在这个目录下

9:  全局环境变量文件

/etc/profile  系统全局变量的配置文件

[root@localhost init.d]# cat /etc/profile
# /etc/profile# System wide environment and startup programs, for login setup  #系统全局变量和启动程序
# Functions and aliases go in /etc/bashrc# It's NOT a good idea to change this file unless you know what you  #除非你知道你要做什么,否则不要更改
# are doing. It's much better to create a custom.sh shell script in  #更好的是去创建脚本在/etc/profile.d,去改变
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.pathmunge () {case ":${PATH}:" in*:"$1":*);;*)if [ "$2" = "after" ] ; thenPATH=$PATH:$1elsePATH=$1:$PATHfiesac
}if [ -x /usr/bin/id ]; thenif [ -z "$EUID" ]; then# ksh workaroundEUID=`id -u`UID=`id -ru`fiUSER="`id -un`"LOGNAME=$USERMAIL="/var/spool/mail/$USER"
fi# Path manipulation
if [ "$EUID" = "0" ]; thenpathmunge /sbinpathmunge /usr/sbinpathmunge /usr/local/sbin
elsepathmunge /usr/local/sbin afterpathmunge /usr/sbin afterpathmunge /sbin after
fiHOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; thenexport HISTCONTROL=ignoreboth
elseexport HISTCONTROL=ignoredups
fiexport PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; thenumask 002
elseumask 022
fifor i in /etc/profile.d/*.sh ; doif [ -r "$i" ]; thenif [ "${-#*i}" != "$-" ]; then. "$i"else. "$i" >/dev/null 2>&1fifi
doneunset i
unset -f pathmunge
export TMOUT=300
HISTSIZE=50
HISTFILESIZE=50

与之关联的还有一个文件/etc/profile.d,可以存放登录后自动执行的脚本

[root@centos6 ~]# cd /etc/profile.d/
[root@centos6 profile.d]# vi welcome.sh
echo "welcome to mingongge's blog"
[root@centos6 profile.d]# chmod +x welcome.sh
[root@centos6 profile.d]# logout
Last login: Thu Dec 22 13:51:55 2016 from 192.168.197.1
welcome to mingongge's blog

10:  motd文件

/etc/motd  用户登录提示信息

编辑过后,再登录就显示自己编辑的文本。

11:  group文件

/etc/group  用户的组名与相关信息

12:  用户账号相关信息

/etc/passwd  系统所有用户账号信息文件

13:  用户密码相关文件

/etc/shadow  系统所有用户密码信息文件
/etc/gshadow  系统所有组密码信息文件

14:  系统信息文件

/var/log/messages  系统日志文件

/var/log/secure  登陆系统存取信息文件(系统安全日志文件)

15:  定时任务配置文件

/var/spool/cron/  定时任务配置文件

DESCRIPTIONCrontab  is  the program used to install, remove or list the tables  #crontab是程序用来安装,移除或者列出一个表去驱动cron进程。used to drive the cron(8) daemon.  Each user  can  have  their  owncrontab,  and  though these are files in /var/spool/ , they are not  #这些定时文件到在/var/spool/cron下intended to be edited directly. For SELinux in mls mode can be evenmore crontabs - for each range. For more see selinux(8).The  cron  jobs could be allow or disallow for different users. Forclassical crontab there exists cron.allow and cron.deny files.   Ifcron.allow file exists, then you must be listed therein in order tobe allowed to use this command.  If the cron.allow  file  does  notexist  but  the  cron.deny  file  does  exist, then you must not belisted in the cron.deny file in order to use this command.  If nei-ther  of these files exists, only the super user will be allowed touse this command.  The second option is using  PAM  authentication,where  you  set  up  users, which could or couldn’t use crontab andalso system cron jobs from /etc/cron.d/.The temporary directory could be set in  enviroment  variables.  Ifit’s not set by user than /tmp is used.

转载于:https://www.cnblogs.com/caicairui/p/8350702.html

Linux的重要子目录相关推荐

  1. linux 复制包括子目录_【Linux分享】Linux常用命令+教程分享

    今天分享分为两部分 :)PART01 Linux常用命令分享/PART02 关于BD面试经验分享    30mins  Linux Command:PART 1 你本可以张口就来.....本篇内容分享 ...

  2. linux目录权限子目录权限,linux中更改所有子文件和子目录所有者权限

    linux中更改所有子文件和子目录所有者权限,这个需要好好谈谈. Ubuntu中有两个修改命令可以用到,「change mode」&「change owner」 即chmod以及chown,其 ...

  3. linux创建目录及其子目录

    linux下直接一个命令创建目录及其子目录 mkdir -p /media/build/temp/all/subdir

  4. Linux学习笔记-子目录的支持

    在实际的工程项目中会使用子目录: 通常,一个项目下会有多个子目录,一个子目录通常在逻辑上是一个模块(不是强制要求) Makefile相当于项目级的文件 如: MyTestPro/Makefilesrc ...

  5. linux zip 压缩子目录,Linux zip命令:压缩文件或目录

    ".zip"是 Windows 中最常用的压缩格式,Linux 也可以正确识别".zip"格式,这可以方便地和 Windows 系统通用压缩文件. " ...

  6. Linux 删除目录及其子目录指定类型文件

    背景:要将本地maven仓库中的jar包上传到nexus中.  批量操作,将本地jar包仓库的目录(只能包含jar文件, 其他的文件需要删除)直接上传到nexus中即可. 1.  删除目录及其子目录的 ...

  7. linux删除目录及子目录下的所有.log文件

    命令:find . -name "*.log" | xargs rm 解释:find . -name "*.log" 查找目录和子目录下所有的.log文件,xa ...

  8. Linux常见子目录的作用和常用命令

    一.Linux的常见子目录的作用 1./root:系统管理员root的宿主目录,默认情况下只有root用户的宿主目录在根目录下而不是在"/home"目录下. 2./home:普通用 ...

  9. linux基本命令详解の第一季

    linux常用命令一: 文件名命名规则 1)除了/之外,所有的字符都合法. 2)有些字符最好不用,如,空格.制表符.退格符和字符@#¥%()-等. 3)避免使用.作为普通文件名的第一个字符,在linu ...

最新文章

  1. linux 磁盘分区情况6,Linux磁盘分区介绍
  2. 全球首个自适应机械臂:精准抗干扰,斯坦福华人团队打造
  3. 【django】自定义中间件
  4. 科大星云诗社动态20210901
  5. 一款好用的轮播插件swiper,适用于移动端和web
  6. 归纳整理--第4篇--常用软件
  7. Servlet 登录时数据校验
  8. 嵌入式开发中C语言编程要点简述!
  9. 操作系统之进程管理:2、进程的状态以及状态转化
  10. PostgreSQL客户端psql常用命令
  11. 科密a1无法连接数据库_支持无线图传的稳定器——致迅A1-pro图传稳定器
  12. Mysql学习总结(57)——MySQL查询当天、本周、本月、上周、本周、上月、距离当前现在6个月数据
  13. 关于学习新知识的一点想法
  14. 73.fseek与宽字符读取文件
  15. python基础(12):Standard Library标准库(包含正则)
  16. 嵌入式Linux开发|点亮那颗LED灯
  17. c++反向输出一个三位数
  18. 秘密:从程序员到领导者的微妙之处
  19. 微信文章如何采集php,记录微信公众号历史文章采集(二、js代码完善和数据库建立)...
  20. 手机ftp服务器进入制定文件夹,ftp服务器 指定文件夹

热门文章

  1. java对mysql进行查找替换_java对mysql的增删改查
  2. install cuda on ubuntu
  3. java js倒计时_Java实现倒计时的方法详解
  4. 用SegNet进行室内布局语义分割
  5. 面向深度学习研究人员的自然语言处理实例教程
  6. string会被回收吗_互联网大厂面试题:这些面试都会吗?就想要30k?
  7. 密度图的密度估计_R-ggridges包:山峰叠峦图
  8. 中标麒麟怎么安装deb包_请教,如何制作中标麒麟系统可用的安装包?
  9. ICMP协议Ping命令的应用
  10. 设计模式原则之二:开闭原则