Linux directory structure - Central

Chapter 1 / proc directory

1.1 /proc/cpuinfo

Cpu information system

[root@nfsnobody ~]# cat /proc/cpuinfo                  一般常用的是  lscpu
processor   :0 第几个核心  此处表示第一个
vendor_id   : GenuineIntel
cpu family  :6
model       :60
model name  :Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz
stepping    :3
microcode   :34
cpu MHz     :2793.547
cache size  :3072 KB
physical id :0第几颗CPU(物理) 此处表示第一个
###以下还有信息 但是不常用 不再显示
cat/proc/cpuinfo                  一般常用的是  lscpu
[root@nfsnobody ~]# lscpu  查看cpu的信息

1.2 /proc/meminfo                                 

System Memory Information

[root@nfsnobody ~]# cat /proc/meminfo
可以查看内存的信息  信息过长 此处不粘贴详细内容
cat/proc/meminfo  一般用 free -h代替           
-h使free显示的内容可读
total一共    used  使用   free  剩余
[root@nfsnobody ~]# free -h  查看内存信息    -h参数 使free显示的内容可读
total       used       freeshared    buffers     cached
Mem:980M       619M       360M       228K        51M       397M
-/+ buffers/cache:       170M       809M
Swap:767M         0B       767M

1.3 /proc/mounts

· Information system mounts

[root@nfsnobody ~]# cat /proc/mounts
用cat /proc/mounts  信息显示很杂乱  一般用column -t  /proc/mounts代替
[root@nfsnobody ~]# column -t  /proc/mounts ##使文件信息对齐后显示

1.4 /proc/loadavg 

System load information
core figure close to the total number of systems even higher

[root@nfsnobody~]# cat /proc/loadavg      显示系统负载信息
0.0   0.00 0.00 1/167 2280 
最近一分钟  最近5分钟  最近15分钟  有167个进程 有一个在运行
[root@nfsnobody ~]# w                      可用w代替  非全屏状态下可能会报错
 23:30:33up  1:45,3 users,  load average: 0.00,0.00, 0.00
USERTTY      FROM              LOGIN@   IDLEJCPU   PCPU WHAT
roottty1     -                22:04    1:25m0.03s  0.03s -bash
rootpts/0    10.0.0.1         22:05    1:04m0.05s  0.05s -bash
rootpts/1    10.0.0.1         22:27    0.00s0.24s  0.13s w
[root@nfsnobody ~]# uptime   也能够查看系统负载
19:11:33 up 41 min,3 users,  load average: 0.00,0.00, 0.00

Chapter 2 / etc directory

2.1 /etc/sysconfig/network-scripts/ifcfg-eth0

2.1.1 Detailed information card

First NIC configuration file

system config/networ-scripts/interface(接口/w网卡)config

If you want to modify the information to modify the network card restart to take effect

[root@nfsnobody ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0 linux第一块网卡的配置文件
DEVICE=eth0                                        <==设备名称
TYPE=Ethernet                                      <==网络类型以太网 
UUID=9624a449-b94d-4633-9139-e8459206301d          <==系统中给每个设备的标识符号在系统中唯一  
ONBOOT=yes                                         <==boot on 在开机或重启网络的时候自启动
NM_CONTROLLED=yes                                  <==是否受系统的network服务控制
BOOTPROTO=none                                     <==网卡获取IP的方法 网卡静态IP还是动态IP
HWADDR=00:0C:29:91:97:B5                           <==HardWareADDRress硬件地址/MAC地址网卡唯一
IPADDR=10.0.0.201                                  <==服务器的ip地址
PREFIX=24
##等同于NATMASK=255.255.255.0 子网掩码 决定你一个局域网中最多可以有多少台服务器
GATEWAY=10.0.0.254                                gate way 默认网关所有人离开进入都要经过网关
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
DNS1=223.5.5.5                                        <== dns
DNS2=223.6.6.6                                        <== dns
BOOTPROTOstatic/none   静态IP
   dhcp系统默认自动获取IP地址
NATMASK=255.255.255.0  这个一般没有  PREFIX=24 一般由这个代替
子网掩码 决定你一个局域网中最多可以有多少台服务器

2.1.2 DNS

2.1.3 About DNS

DNS (domain name server / system) DNS
DNS (Public DNS) of the disposable
1. aliyun

DNS1 223.5.5.5
DNS2 223.6.6.6
2.114
114.114.114.114
114.114.115.115

2.1.4 DNS increase in NIC

DEVICE=eth0                第一块网卡的配置文件/etc/sysconfig/network-scripts/ifcfg-eth0
 
TYPE=Ethernet
UUID=4107073b-8277-471a-a2e7-a65cb8904475
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:0C:29:47:D6:37
IPADDR=10.0.0.200
PREFIX=24
GATEWAY=10.0.0.254
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
DNS1=223.5.5.5###在底部加上 DNS
DNS2=223.6.6.6
在网卡配置文件/etc/sysconfig/network-scripts/ifcfg-eth0   加上DNS 然后重启网卡
/etc/init.d/network restart

2.1.5 /etc/resolv.conf  

DNS configuration file
card in the configuration file takes precedence over the /etc/resolv.conf  

/etc/resolv.conf                                 dns配置文件
[root@nfsnobody ~]# cat /etc/resolv.conf
# Generated by NetworkManager
 
 
# No nameservers found; try putting DNS serversinto your
# ifcfg files in /etc/sysconfig/network-scriptslike so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
nameserver 223.5.5.5
nameserver 223.6.6.6

2.2 /etc/sysconfig/network

Permanent (restart server) modify the host name of the place

[root@nfsnobody ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=nfsnobody

2.3 /etc/sysconfig/network

2.3.1 temporarily modify the hostname

hostname

1.临时修改hostname
[root@nfsnobody ~]# hostname nfsnobody  修改
[root@nfsnobody ~]# hostname              查看
nfsnobody

2.3.2 permanently modify the hostname

[root@nfsnobody ~]# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=nfsnobody   ##把名字修改为你要改的
修改完退出  重启服务器后生效

2.4 /etc/hosts  

ip domain name (hostname) analytical relationship

2.4.1 application scenarios

Set up a test environment
LAN DNS (understand)

2.4.2 understand the role of / etc / hosts of

[root@nfsnobody ~]# cat /etc/hosts                          查看内容
127.0.0.1localhost localhost.localdomain localhost4 localhost4.localdomain4
::1localhost localhost.localdomain localhost6 localhost6.localdomain6
测试
[root@nfsnobody ~]# vim /etc/hosts
127.0.0.1localhost localhost.localdomain localhost4 localhost4.localdomain4
::1localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.0.200 jd.com            ###IP地址与域名的对应关系
 
[root@nfsnobody ~]# ping jd.com   再次ping  京东 IP地址变为10.0.0.200
PING jd.com (10.0.0.200) 56(84) bytes of data.
64 bytes from jd.com (10.0.0.200): icmp_seq=1ttl=64 time=0.031 ms
64 bytes from jd.com (10.0.0.200): icmp_seq=2ttl=64 time=0.026 ms

2.5 /etc/fstab

Created for each device at boot time an entry boot time automatically mount list

[root@nfsnobody ~]# column -t /etc/fstab  用 column -t 查看 可以先排列好内容再显示
#
#/etc/fstab
#Created     by            anaconda        on       Tue         Jul         1018:21:44     2018
#
#Accessible  filesystems,  by              reference,  aremaintained  under   '/dev/disk'
#See         man           pages           fstab(5),   findfs(8),mount(8)    and/or  blkid(8)for   more  info
#
UUID=c4f4be67-f408-4f14-b01e-a0c0777932cb  /ext4          defaults        1           1
UUID=8dc40910-35ed-4d1b-acd7-5dad0ad47746  /boot   ext4          defaults        1           2
UUID=09e2ce6c-7249-4239-8843-5ef9cc3a9a99  swapswap          defaults        0           0
tmpfs/dev/shm    tmpfs         defaults        0           0
devpts                                     /dev/pts    devpts        gid=5,mode=620  00
sysfs                                      /sys        sysfs         defaults        0           0
proc/proc       proc          defaults        0           0
设备磁盘分区                               挂载点
 
[root@nfsnobody ~]# blkid   可用blkid显示的信息与上面内容对比
/dev/sda1:UUID="8dc40910-35ed-4d1b-acd7-5dad0ad47746" TYPE="ext4" 
/dev/sda2:UUID="09e2ce6c-7249-4239-8843-5ef9cc3a9a99" TYPE="swap" 
/dev/sda3:UUID="c4f4be67-f408-4f14-b01e-a0c0777932cb" TYPE="ext4"

2.6 /etc/rc.local

Storing boot from the start of the program or command to run automatically boot time

[root@nfsnobody ~]# cat /etc/rc.local 
#!/bin/sh
#
# This script will be executed *after* all theother init scripts.
# You can put your own initialization stuff in hereif you don't
# want to do the full Sys V style init stuff.
##需要开机自启动的命令或脚本可以放在这个文件内
##效果类似于win7下面的启动

2.7 /etc/inittab  

2.7.1 Run-level profile 

[root@nfsnobody ~]# cat /etc/inittab 
# inittab is only used by upstart for the defaultrunlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NOEFFECT 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.confand /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), andinitctl(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 - Fullmultiuser mode                     
#   4 -unused                                  
#   5 -X11                                      
#   6 -reboot (Do NOT set initdefault to this)  
# 
id:3:initdefault:           需要更改直接vim在此处修改就可以

2.7.2 Detailed operational level

#   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) ##多用户模式 没有NFS
#   3 - Fullmultiuser mode                      
##完全多用户模式 (命令行模式/文本模式)工作默认的环境
#   4 -unused                                   待开发
#   5 -X11                                      桌面模式图形化界面
#   6 -reboot (Do NOT set initdefault to this)  #重启

 

Chapter 3 Linux no Internet access

3.1 Troubleshooting Process

3.1.1 confirm whether access to the Internet

ping baidu.com

3.1.2 DNS configuration issues

ping ip address (public IP)

223.5.5.5
114.114.114.114

3.2 common cause

Resulting in no Internet access in common cause
1.IP address is correct
2. NIC configuration file is correct
  gateway configuration errors
3.VMware virtual network card configuration
4. vmware8-Fi is turned on
5. Service is turned
6. If the modified under virtual gateway to modify restart machine

Guess you like

Origin www.cnblogs.com/wenrulaogou/p/11982022.html