Network configuration
After installing the minimal version system, the CentOS system's NIC is not enabled by default, and we can edit the network configuration with the following command:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
If you use DHCP, you need to set the following format:
Device=eth0
Hwaddr=08:00:27:0f:5c:17
Type=ethernet
uuid=64ea57af-9329-40c4-90da-bf239cecea4f
Onboot=yes
Nm_controlled=yes
Bootproto=dhcp
If you are a fixed IP, you need to set the following format:
Device=eth0
Hwaddr=08:00:27:0f:5c:17
Type=ethernet
uuid=64ea57af-9329-40c4-90da-bf239cecea4f
Onboot=yes
Nm_controlled=yes
Bootproto=static
ipaddr=192.168.0.2
netmask=255.255.255.0
gateway=192.168.0.1
dns1=61.128.128.68
dns2=61.128.128.69
Ipv6init=no
When Setup is complete, you need to restart the network service by running the following command:
Service Network restart
Finally, you can use the following command to view the IP address:
Ifconfig
Reboot/Shutdown command
Reboot command:
Reboot
Shutdown-r now #立刻重启 (used by root)
Shutdown-r #过10分钟自动重启 (used by root)
Shutdown-r 23:59 #在时间为23: Reboot at 59 (root user)
#如果是通过shutdown命令设置重启的话, you can cancel the reboot with the SHUTDOWN-C command
Shutdown command:
Halt #立刻关机
Poweroff #立刻关机
Shutdown-h now #立刻关机 (used by root)
Shutdown-h #10分钟后自动关机
#如果是通过shutdown命令设置关机的话, you can cancel the reboot with the SHUTDOWN-C command
Cleanup command
sudo yum AutoClean
sudo yum clean
sudo yum autoremove
These three commands primarily clean up the upgrade cache and the unwanted packets.
ls command
ls [options] [Files/directories]
-a displays all files, including hidden information
-L Display Details
-D View Directory properties
-H humanized Display file size
-I display Inode
Extended:
# LS-LH File Permissions Interpretation
-rw-r--r--. 1 root 7.5K November 9 15:45 Install.log
#-File type
# rw-Owner Permissions
# r--Owning group permissions
# r--Other People's permissions
# . Delegate ACL permissions
# 1 Reference count
# root Owner
# Root All Groups
# r Read/w Write/x execution
Directory processing commands
# Create a directory
mkdir [Options] [contents]
-P Recursive processing
# mkdir-p Blog/css
# Toggle Directory (tab to identify directory completion)
CD [Directory]
~ Enter User Home directory
-Go to last directory
.. Go to Superior Directory
. Enter current directory
# Displays the current directory
Pwd