CentOS的几个命令

查看cpu
[root@llpt7 ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
     12  Intel(R) Xeon(R) cpu E5-2620 v3 @ 2.40GHz
12核

[root@llpt7 ~]#  getconf LONG_BIT
64
当前cpu运行在64位下

2.查看内存
[mushme@investide ~]$ free -mh

重点:记录CentOS 7与以往不同的地方

  1.取消ifconfig,使用ip addr 或者 ipa a 查看IP地址。
    2. 安装 ifconfig 和 nslookup: yum install net-tools, yum install bind-utils, nslookup,dig在bind-utils中

  3.使用firewalld 取代 iptables。

  4.系统认编码设置文件,由/etc/sysconfig/i18n  更改为 /etc/locale.conf

1. How to configure a static IP address on CentOS 7
http://ask.xmodulo.com/configure-static-ip-address-centos7.html
2. Linux有问必答:如何为CentOS 7配置静态IP地址
https://linux.cn/article-3977-1.html

1. To verify the status of Network Manager service:

systemctl status NetworkManager.service 

2. To check which network interface is managed by Network Manager, run:

nmcli dev status

3.不使用网络管理配置静态IP地址, 可以直接修改 /etc/sysconfig/network-scripts/ifcfg-enp0s3 文件,然后执行
  systemctl restart network.service 或者 service network restart
IPADDR=192.168.56.40
PREFIX=24
NM_CONTROLLED=no

HWADDR=08:00:27:4F:B6:68

TYPE=Ethernet

BOOTPROTO=none

NM_CONTROLLED=no

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME="Wired connection 1"

UUID=221c3c3a-5e15-3f05-9bdf-869eae33129f

ONBOOT=yes

AUTOCONNECT_PRIORITY=-999

IPADDR=192.168.56.40

PREFIX=24

IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes


请切记不能写GATEWAY在ifcfg文件中。

“NM_CONTROLLED=no”表示该接口将通过该配置文件进行设置,而不是通过网络管理器进行管理。“ONBOOT=yes”告诉我们,系统将在启动时开启该接口。

4. dns在 vi /etc/resolv.conf中配置:
[root@mouse ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 202.96.134.133


====================================
检查安全补丁centos6.x, centos7.x
yum --security upgrade

查询某个命令属于哪个安装包? 例如查询 lsb_release
yum provides */lsb_release

yum whatprovides lsb_release


Centos/Linux下如何查看网关地址/Gateway地址
2015-09-10 16:49 5248人阅读 评论(0) 收藏 举报
Centos/Linux下如何查看网关地址/Gateway地址? Linux下查看网关的命令还是很多的,不过如果IP是DHCP获取,那么有些命令是不适用的,当然也有通用的查询网关命令.

1.ifconfig -a 和 cat /etc/resolv.conf  (主要查看ip/netmask和dns)

2.netstat -rn

3.cat /etc/sysconfig/network

4.cat /etc/sysconfig/network-scripts/ifcfg-eth0

5.traceroute 第一行就是自己的网关

6.ip route show

7.route -n

===
B - CentOS 6

yum -y install wget lrzsz

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

wget -O /etc/yum.repos.d/CentOS-Base-163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

yum clean all

yum makecache

yum install vim* 测试是否源可用
yum update -y
yum --releasever=6.6 update -y

6、reboot

7、查看系统类型cat /etc/redhat-*(忘记*是啥了,直接Tab键即可)

回退到上个小版本Downgrade the the redhat-release package to complete the process. The command below targets the latest minor version that is lower than the current running one, such as from 6.5 to 6.4, or from 6.4 o 6.3:
yum downgrade redhat-release

cat /etc/redhat-release
 

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native