Learn more about the data file directory structure important information
1. important documents - NIC configuration file (focus)
1) file content information
[root@lin tmp]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE = Ethernet - Ethernet Ethernet network type specified telephone 10M military (Frame Relay) Finance Corporation (FastEthernet)
BOOTPROTO = none - how to network boot protocol allows hosts to obtain IP address
a own manual configuration none static (static)
b obtain an address automatically dhcpd (understand)
NAME = eth0 - NIC host name logical name
UUID = 31d48995-e74f-4f99-8e19-0da439ea257b - web hosting, will give each a hardware identification
Name of the device name of the host network card - DEVICE = eth0 physical name
= ONBOOT yes - to set whether the card is turned on (active state)
IPADDR = 10.0.0.200 - statically configured IP address to identify the host name corresponding to the human identity
PREFIX = 24 - the number of defined network can host how many people can be inside the room
GATEWAY = 10.0.0.2 - one network to another network, the only way people from one country to another, the only way (Customs)
DNS1 = 223.5.5.5 - DNS (established name and IP address corresponding relationship) 14.215.177.38 - Name
2) modify the configuration file to restart the service
method one:
systemctl restart network for all network cards reboot
systemctl status network
Method two: common usage in enterprises
eth0 ifdown && ifup eth0 for the specified network card restart
Unusual problem: NIC configuration file correctly, you can not restart the network services
systemctl stop NetworkManager Network management services shut down
2. important documents -DNS parsing the configuration file (understand)
[root@lin ~]# vi /etc/resolv.conf
# Generated by NetworkManager
search com
nameserver 114.114.114.114
3. important documents - the host name of the file
Centos7 how to modify the host name:
Temporary modifications:
hostname hostname
:( permanent modifications to reboot the system to load the configuration file)
[root@lin ~]# vi /etc/hostname
[root@lin ~]# hostnamectl set-hostname linlin
Centos6 how to modify the host name:
Temporary modifications:
hostname oldboy-sz-01
Permanent modifications:
vi /etc/sysconfig/network
Added: how to view the system version
[root@oldboy-sz-01 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
4. Important documents - parsing mapping file
hosts file: establishing correspondence between the IP address and host name of the local
windows local parsing file location:
C:\Windows\System32\drivers\etc\hosts
Linux native parsing file location:
/etc/hosts
Format: ip domain name
5. important files - disk to mount file
/ Etc / fstab --- achieve storage device is turned on automatically mount configuration files
Added: df command
UUID=230b85a4-66a9-405e-acb7-70c287357cc7 / xfs defaults 0 0
UUID=be4575ca-b38d-4e4c-9010-c59ff76a89ee /boot xfs defaults 0 0
UUID=275c53ba-50ff-46a7-99ac-5be783a1afa6 swap swap defaults 0 0
format:
The definition file information storage device file system mount points
/dev/cdrom /mnt iso9660 defaults 0 0
6. important files - boot from the start (automatic loading) files
/etc/rc.local
File effect:
Content information A) file will be loaded after system startup
B) the preparation of the contents of the file must be command information eg. Systemctl start sshd / touch / linlin
chmod + x /etc/rc.d/rc.local (centos7 need to do this in order to use this file)
7. important documents - the system startup file level
runlevel command to view the current system run level
Role: Change system run levels
Syntax: the init 0-6
Linux 7 a Start level:
0 system shutdown mode, the system default run level can not be set to 0 , otherwise it does not start, turn off the machine
1 single-user mode, root privileges for system maintenance, prohibits remote login, just like Windows safe mode login
2 multi-user mode without NFS and network support
3 full multi-user text mode with NFS and network, after landing into the console command line mode
4 system is not used, reserved generally do not, in some special cases you can use it to do something. For example, when the laptop battery exhaustion, this mode can be switched to do some settings
5 graphics mode, after landing into the graphical GUI mode, the X-Window system
6 restart mode, the default operating level can not be set to 6 , or can not start properly. Running init 6 machine will restart
Temporarily modify the system's start level:
init 0-6
Set the default start level (permanent setting):
Centos6 in modifying / etc / inittab file to configure the default start level
centos7 no longer use the / etc / inittab file to start the default level configuration, and use than sysvinit more free-running level of the target instead.
systemctl set-default xxx.target
View run levels: System GET-default
The third set the default start level
[root@lin ~]# systemctl set-default multi-user.target
8. The variable load file
Setting variables: variable name = variable value
The transfer of variable: $ variable name
/ Etc / profile so that permanent variable information
Methods files directly in force:
Source /etc/profile
System variable types:
Ordinary variables
Environment Variables
Modify the PATH environment variable method:
Temporary modifications:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/oldboy
Permanently set:
vi /etc/profile
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/oldboy