码迷,mamicode.com
首页 > 系统相关 > 详细

Linux目录结构-中部

时间:2019-12-04 13:30:22      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:ifcfg-eth   内存   rmi   过程   share   div   baidu   pst   测试   

第1章 /proc目录下

1.1 /proc/cpuinfo

系统cpu信息

[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 ????????????????????????????????

系统内存信息

[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

系统挂载信息 ·

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

1.4 /proc/loadavg?

系统负载信息
数字接近系统的核心总数的? 就算是高了

[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

第2章 /etc目录下

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

2.1.1 网卡信息详解

第一块网卡的配置文件

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

如果要修改网卡的信息 ?修改后重启即可生效

[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 关于DNS

DNS? (domain name server/system)域名解析
可随意使用的DNS(公共DNS)
1.阿里云

DNS1 223.5.5.5
DNS2 223.6.6.6
2.114
114.114.114.114
114.114.115.115

2.1.4 在网卡中增加DNS

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配置文件
网卡里的配置文件优先于/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

永久(重启服务器)修改主机名的地方

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

2.3 /etc/sysconfig/network

2.3.1 临时修改主机名

hostname

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

2.3.2 永久修改主机名

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

2.4 /etc/hosts??

ip与域名(主机名)解析关系

2.4.1 应用场景

搭建测试环境
局域网DNS(了解)

2.4.2 了解/etc/hosts的作用

[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

在开机的时候给每个设备创建一个入口? 开机的时候自动挂载列表

[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

存放开机自启动的程序或命令? 开机的时候自动运行

[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 运行级别的配置文件?

[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 运行级别详解

#?? 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)? #重启

?

第3章 Linux无法上网

3.1 排错过程

3.1.1 确认是否能上网

ping baidu.com

3.1.2 DNS配置问题

ping ip地址 (公网IP)

223.5.5.5
114.114.114.114

3.2 常见原因

导致无法上网的常见原因
1.IP地址是否正确
2.网卡配置文件是否正确
? 网关配置错误
3.VMware虚拟网卡配置
4.网络连接 ?vmware8是否开启
5.服务是否开启
6.如果修改网关 修改后重启下虚拟机

Linux目录结构-中部

标签:ifcfg-eth   内存   rmi   过程   share   div   baidu   pst   测试   

原文地址:https://www.cnblogs.com/wenrulaogou/p/11982022.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!