Linux--重要文件

/etc/resolv.conf

  • 说明:设置Linux本地的DNS的配置文件
  • 查看文件内容
[root@39 ~]# cat /etc/resolv.conf
nameserver 10.0.0.2

注意:网卡的配置文件的DNS优先于/etc/resolv.conf配置的DNS
DNS:实现域名和IP的互相解析

/etc/host

  • 说明:域名和IP地址的对应关系

  • 作用:

    • 一般在搭建测试环境的时候使用
    • 服务器之间的调用可以用域名(内部的DNS)
  • 查看内容

[root@39 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

/etc/sysconfig/network

  • 说明:可修改主机名及网卡启动,网关等配置
  • 查看内容
[root@39 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=39

/etc/fstab

  • 说明:实现开机要挂载的文件系统的列表,磁盘分区与目录的挂载关系
  • 查看内容
[root@39 ~]# cat /etc/fstab 
#
# /etc/fstab
# Created by anaconda on Sun Jul 16 22:37:07 2017
#
# 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=74e27aa2-9d68-405b-a49a-0faa5cae3a9d /                       ext4    defaults        1 1
UUID=0e3eff1e-f02c-4d7f-a17e-3b632f5e2e0b /boot                   ext4    defaults        1 2
UUID=1f9bbd5d-869e-487a-80a6-f20664a98111 swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

/etc/rc.local

  • 说明:文件中放着开机需要启动的命令或脚本
  • 查看内容
[root@39 ~]# cat /etc/rc.local 
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

/etc/profile

  • 说明:系统全局环境变量永久生效的配置文件,定义别名以及PATH变量等
  • 查看内容
[root@39 ~]# head -5 /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

/etc/bashrc

  • 说明:放置别名
  • 查看内容
[root@39 ~]# head -5 /etc/bashrc 
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile

/etc/motd

  • 说明:用户登录之后显示的内容
  • 设置登录显示内容
[root@39 ~]# echo "welcome to linux" > /etc/motd

/usr/local

  • 说明:编译安装的默认安装位置
  • 查看内容
[root@o39 ~]# ls /usr/local/
bin  etc  games  include  lib  lib64  libexec  sbin  share  src

/var

  • 说明:存放系统日志
  • 介绍目录:
/var/log/ :各种系统日志存放地
/var/log/messages :系统信息默认日志文件。按周更新
/var/log/secure :记录用户的登录信息
				 (什么时候登录的,是否成功,在哪登录的)
/var/log/wtmp :记录登陆者的信息的文件
/var/spool/cron/root :定时任务的配置文件

/proc

  • 说明:虚拟内存的映射
  • 介绍目录
/proc/cpuinfo : CPU信息
/proc/meminfo :内存信息
/proc/loadavg :平均负载(系统的繁忙程度)  (1min 、5min、15min)
/proc/mounts :系统的挂载信息
原文地址:https://www.cnblogs.com/os-linux/p/11908603.html