一、 [root@localhost ~]#
root: 代表当前用户的用户名
localhost: 主机名
~: 当前用户的家目录
#: 超级用户的命令提示符
CST:时区
查询时区
查看时间:
系统时间:date
硬件时间:hwclock -r
修改时间:
系统时间:date -s" 2024-1-3 10:25:00 "
硬件时间: hwclock --set --date"2024-1-3 10:24:00 "
如何查看服务器能上网:
ping baidu.com
PING baidu.com (110.242.68.66) 56(84) bytes of data. 64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=128 time=31.1 ms 64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=2 ttl=128 time=24.2 ms 64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=128 time=23.5 ms
ctrl+c 终止
ctrl+l 清屏 clear
网络时间 授时中心 域名 ntp.aliyun.com time.windows.com
ntpdate time.windows.com
将系统的时间同步给硬件:hwclock --systohc
将硬件时间同步给系统:hwclock -- hctosys
将硬件时间保存到主板:hwclock -w
下面的命令只是在vi编辑命令中使用
:wq:表示保存退出
:wq!:表示强制保存退出
:x:表示保存退出
:q:在vim中表示退出
:q!:表示强制不保存退出,不对文件进行保存
二、 网卡
启动网卡:ifup ens33
查看网卡IP地址:ip a
网卡开机自启动:
1.编辑网卡配置文件: vi /etc/sysconfig/network-scripts/ifcfg-ens33
光标到最后一行,将ONBOOT=no改为yes
2.重启网卡: systemctl restart network
三、防火墙
查看防火墙的状态:
systemctl status firewalld
关闭防火墙: systemctl stop firewalld
设置开机不自启动: systemctl disable firewalld
四、selinux
查看selinux状态
getenforce
Enforcing 开启状态
Permissive 临时关闭
Disabled 永久关闭
临时关闭
setenforce 0
永久关闭
vi /etc/selinux/config
SELINUX=enforcing 改成 SELINUX=disabled