书接上回,我们继续date命令操作,下面是有关改变时间和时区的相关密令:
timedatectl:全程其实就是 time date control 时间和日期控制,可以在linux系统中更改当前的时间,时区,地区。具体操作如下:
(1)[root@bogon gousheng]# timedatectl set-time "2022-03-21 10:10:00" 更改时间,日期
设置完成
再看看几种错误的格式:
<1>[root@bogon gousheng]# timedatectl set-time "20220320 11:30:00" #错误的
Failed to parse time specification '20220320 11:30:00': Invalid argument
<2>[root@bogon gousheng]# timedatectl set-time "2022/03/20 11:30:00" # 错误的
Failed to parse time specification '2022/03/20 11:30:00': Invalid argument
<3>[root@bogon gousheng]# timedatectl set-time "2022.03.20 11:30:00" # 错误的
Failed to parse time specification '2022.03.20 11:30:00': Invalid argument
以上三种格式都会使操作系统报错。
(2) [root@bogon gousheng]# timedatectl set-timezone "Asia/Shanghai"设置时区
设置完成后我们可以是如下命令来查看我们的所有当前时间设定:
[root@bogon gousheng]# timedatectl status
Local time: Mon 2022-03-21 10:16:28 CST
Universal time: Mon 2022-03-21 02:16:28 UTC
RTC time: Mon 2022-03-21 02:16:28
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
[3].有关电源的操作
(1) [root@bogon gousheng]# reboot 重启系统。
(2) [root@bogon gousheng]# poweroff 系统关机。
(4) [root@bogon gousheng]# halt 关机
(4) [root@bogon gousheng]# shutdown 可以实现以上三者的全部功能,可以指定时间关机。
注:halt使用方法:
使用权限:系统管理者 halt
使用方式:halt [-n] [-w] [-d] [-f] [-i] [-p]
说明:若系统的 runlevel 为 0 或 6 ,则关闭系统,否则以 shutdown 指令(加上 -h 参数)来取代。
参数:
-n : 在关机前不做将记忆体资料写回硬盘的动作。
-w : 并不会真的关机,只是把记录写到 /var/log/wtmp 档案里。
-d : 不把记录写到 /var/log/wtmp 档案里(-n 这个参数包含了 -d) -f : 强迫关机,不呼叫 shutdown 这个指令。
-i : 在关机之前先把所有网络相关的装置先停止。
-p : 当关机的时候,顺便做关闭电源(poweroff)的动作。
【4】.wget操作
wget: web get 网络获取,下载
语法格式: wget [参数] url
参数:
# -b: 后台下载, 它不在前台显示
# -O file&#x