1、修改当前主机名为rhcsa,设置当前时区为Asia/Shanghai
[root@rhcsa0701 ~]# hostnamectl hostname rhcsa
[root@rhcsa0701 ~]# host
host hostid hostname hostnamectl
[root@rhcsa0701 ~]# hostnamectl
Static hostname: rhcsa
Icon name: computer-vm
Chassis: vm 🖴
Machine ID: 398520f0c8ec43f7a5a18af761b3ebeb
Boot ID: de398c50fd604437851671be38e1e2dd
Virtualization: vmware
Operating System: Red Hat Enterprise Linux 9.1 (Plow)
CPE OS Name: cpe:/o:redhat:enterprise_linux:9::baseos
Kernel: Linux 5.14.0-162.6.1.el9_1.x86_64
Architecture: x86-64
Hardware Vendor: VMware, Inc.
Hardware Model: VMware Virtual Platform
[root@rhcsa0701 ~]# timedatectl set-timezone Asia/S
Asia/Saigon Asia/Samarkand Asia/Shanghai Asia/Srednekolymsk
Asia/Sakhalin Asia/Seoul Asia/Singapore
[root@rhcsa0701 ~]# timedatectl set-timezone Asia/Shanghai
[root@rhcsa0701 ~]# timedatectl
Local time: 一 2023-07-03 20:41:29 CST
Universal time: 一 2023-07-03 12:41:29 UTC
RTC time: 一 2023-07-03 12:41:29
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
2、在/home/和/root目录下面创建file1文件和dir1目录
[root@rhcsa ~]# mkdir -pv /home/file1 /root/dir1
mkdir: 已创建目录 '/home/file1'
mkdir: 已创建目录 '/root/dir1'
3.在/home/file1文件里面写入内容hello,welcome to home
[root@rhcsa ~]# ls /home/file1
'hello,welcome to home '
4、在/root/file1文件里面写入当前的时间并写入内容this is administrator
[root@rhcsa ~]# touch /root/file1
[root@rhcsa ~]# echo this is administrator > /root/file1
[root@rhcsa ~]# date >> /root/file1
[root@rhcsa ~]# cat /root/file1
this is administrator
2023年 07月 03日 星期一 22:01:42 CST
5、在/root/dir1目录下面新建文件file2,内容和/root/file1文件内容一样
[root@rhcsa ~]# mkdir -pv /root/dir1/file1
mkdir: 已创建目录 '/root/dir1'
mkdir: 已创建目录 '/root/dir1/file1'
[root@rhcsa ~]# cat /root/file1 > /root/dir1/file2
[root@rhcsa ~]# cat /root/dir1/file2
this is administrator
2023年 07月 03日 星期一 22:01:42 CST