Centos常规文件作用
一、系统相关的文件
1、系统版本文件
[root@master ~]# cat /etc/redhat-release centos查看系统版本 CentOS Linux release 7.5.1804 (Core) [root@master ~]# cat /proc/version 查看系统版本及内核版本 Linux version 3.10.0-862.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Fri Apr 20 16:44:24 UTC 2018 [root@master ~]# uname -a 查看系统版本 Linux master 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux [root@master ~]# file /bin/ls 查看系统位数 /bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c5ad78cfc1de12b9bb6829207cececb990b3e987, stripped [root@master ~]# getconf LONG_BIT 查看系统位数 64 [root@master ~]# lsb_release -a 查看系统信息,外部命令,需要安装(yum install -y redhat-lsb) LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.5.1804 (Core) Release: 7.5.1804 Codename: Core
2、系统资源文件
[root@master ~]# cat /proc/cpuinfo 查看系统cpu信息 processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 158 model name : Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz stepping : 10 microcode : 0xb4 cpu MHz : 3000.001 cache size : 9216 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes [root@master ~]# cat /proc/meminfo 查看系统内存信息 MemTotal: 4028432 kB MemFree: 3175572 kB MemAvailable: 3633008 kB Buffers: 2092 kB Cached: 648380 kB SwapCached: 0 kB Active: 303876 kB Inactive: 384740 kB Active(anon): 38816 kB Inactive(anon): 11116 kB Active(file): 265060 kB Inactive(file): 373624 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 38140 kB Mapped: 24996 kB Shmem: 11792 kB Slab: 89092 kB SReclaimable: 47692 kB SUnreclaim: 41400 kB KernelStack: 3712 kB PageTables: 3560 kB NFS_Unstable: 0 kB
3、操作系统相关文件
[root@master ~]# cat /etc/hostname 查看主机名
master
[root@master ~]# hostname slave 临时修改主机名
[root@master ~]# hostnamectl set-hostname slave 永久修改主机名
[root@master ~]# su 马上生效
[root@master ~]# cat /etc/hosts 查看主机dns映射 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 10.0.0.11 master master.hdp 10.0.0.31 slave1 slave1.hdp [root@master ~]# cat /etc/sysconfig/network 此文件是针对本计算机的,是给计算机起的一个名字,是计算机的一个标识 # Created by anaconda NETWORKING=yes HOSTNAME=master.hdp
4、网卡信息文件
[root@master ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 网卡文件 TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="none" 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="ens33" UUID="1dc50805-9702-4486-8d92-35676bd20f07" DEVICE="ens33" ONBOOT="yes" IPADDR="10.0.0.11" PREFIX="24" GATEWAY="10.0.0.2" DNS1="101.198.198.198" DNS2="8.8.8.8" IPV6_PRIVACY="no" [root@master ~]# ip -4 a 查看IP地址 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 10.0.0.11/24 brd 10.0.0.255 scope global noprefixroute ens33 valid_lft forever preferred_lft forever
5、目录作用
[root@master ~]# ls /etc/init.d/ 存放服务的启动文件 functions netconsole network README [root@master ~]# cat /etc/sysconfig/selinux selinux配置文件 # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted