Operating system-related
Immediate shutdown: shutdown-h now
User-related
Delete User Userdel Liuyanfei
Add User Useradd Liuyanfei
Set new user password passwd Liuyanfei
File/folder Related
- LS lists all files or folders under the current folder
- chmod modifying file or folder permissions
Enables normal users to execute commands with root privileges
After the root user logs in, edit the/etc/sudoers file, locate the following line, and add a row under root, as shown below:
# allow ROOT to run any commands anywhere
Root all= (All) all
Liuyanfei all= (All) all
After the modification, can now log in with Liuyanfei account, and then use the command Su-, you can get root permissions to operate
Set Network IP Address:
- Modify IP Address file/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
Bootproto=static
broadcast=192.168.197.255
hwaddr=00:0c:29:22:b0:7e
ipaddr=192.168.197.100
Ipv6init=no
Ipv6_autoconf=no
netmask=255.255.255.0
network=192.168.197.1
Nm_controlled=no #不受Network Manager control
Onboot=yes
- Modify Modify gateway address file/etc/sysconfig/network
Networking=yes
Hostname=centos1
gateway=192.168.197.1
- Modify the DNS file/etc/resolv.conf
NameServer 8.8.8.8 #google域名服务器
NameServer 114.144.114.114 #国内域名服务器
- Restart the NIC
# Service Network Restart
Linux common commands (CentOS)