linux系统相关文件和操作

查看内核:   uname -r

[root@server0 ~]# uname -r
3.10.0-123.1.2.el7.x86_64
[root@server0 ~]# 

查看版本:   cat  /etc/redhat-release

[root@server0 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[root@server0 ~]# 

查看内存:     cat  /proc/meminfo

[root@server0 ~]# cat /proc/meminfo 
MemTotal:         836720 kB
MemFree:          268620 kB
MemAvailable:     424700 kB
Buffers:             688 kB
Cached:           275000 kB
SwapCached:            0 kB
Active:           235608 kB

查看cpu:    lscpu

[root@server0 ~]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1

查看主机名: hostname 

[root@S ~]# hostname
S.tedu.com

设置主机名:

  1.永久:vim /etc/hostname

      new_hostname

  2.临时:hostname  new_hostname

linux光驱设备:/dev/cdrom

      mount /dev/cdrom target_path  将光驱设备挂载到targer_path(访问点)

      umount targer_path 卸载访问点

  ntfs 格式的硬盘无法访问: mount -t ntfs-3g /dev/sdb1 /mnt

用户基本信息文件:  /etc/passwd

密码信息文件        :   /etc/shadow

组基本信息文件:     /etc/group

组成员信息:       /etc/gshadow

配置网卡:

网卡配置文件:     /etc/sysconfig/network-scripts/ifcfg-eth0

dns文件:      /etc/resolv.conf

配置以下静态参数:

ip地址:172.25.0.11

子网掩码:255.255.255.0

默认网关:172.25.0.254

DNS服务器:172.25.254.254

[root@localhost ~]# ifconfig | head -9
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.0.130  netmask 255.255.255.0  broadcast 172.25.0.255
        inet6 fe80::5054:ff:fe00:b  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:00:00:0b  txqueuelen 1000  (Ethernet)
        RX packets 10201  bytes 773502 (755.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2610  bytes 327324 (319.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# nmcli connection modify 'System eth0' ipv4.method manual ipv4.addresses '172.25.0.11/24 172.25.0.254' ipv4.dns 172.25.254.254 connection.autoconnect yes
[root@localhost ~]# nmcli connection up 'System eth0' 
[root@server0 ~]# ifconfig | head -9
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.0.11  netmask 255.255.255.0  broadcast 172.25.0.255
        inet6 fe80::5054:ff:fe00:b  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:00:00:0b  txqueuelen 1000  (Ethernet)
        RX packets 10859  bytes 838462 (818.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2944  bytes 363161 (354.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@server0 ~]# 

 

原文地址:https://www.cnblogs.com/ray-mmss/p/9913541.html