csa第二天作业

文章描述了如何在RedHatEnterpriseLinux9.1系统中修改主机名为rhcsa,将时区设置为Asia/Shanghai,以及在/home/和/root目录下创建文件和目录,并写入特定内容。同时,还在其他目录下创建了与已有文件内容相同的文件。
摘要由CSDN通过智能技术生成

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
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值