day1
1.查看 root 用户家目录的目录内容
[root@haha ~]# ls /root
anaconda-ks.cfg
2、以长列表格式查看 tmp 目录的内容
[root@haha ~]# ls /tmp -l
总用量 0
drwx------ 3 root root 17 7月 21 14:34 systemd-private-e01a46e4fc9c4d16bff8c80040d91f21-chronyd.service-YMwmcO
drwx------ 3 root root 17 7月 21 14:34 systemd-private-e01a46e4fc9c4d16bff8c80040d91f21-dbus-broker.service-Mdx9CL
drwx------ 3 root root 17 7月 21 14:34 systemd-private-e01a46e4fc9c4d16bff8c80040d91f21-irqbalance.service-lTa4ji
drwx------ 3 root root 17 7月 21 14:34 systemd-private-e01a46e4fc9c4d16bff8c80040d91f21-kdump.service-rkKIe1
drwx------ 3 root root 17 7月 21 14:34 systemd-private-e01a46e4fc9c4d16bff8c80040d91f21-systemd-logind.service-T7gxj2
drwx------ 2 root root 6 7月 21 14:24 vmware-root_898-2722239165
drwx------ 2 root root 6 7月 21 14:22 vmware-root_899-3988097379
drwx------. 2 root root 6 7月 19 11:32 vmware-root_900-2722108090
drwx------ 2 root root 6 7月 21 14:34 vmware-root_901-3988228452
drwx------ 2 root root 6 7月 19 12:00 vmware-root_902-2730562360
drwx------ 2 root root 6 7月 19 12:02 vmware-root_904-2697008433
drwx------. 2 root root 6 7月 19 11:28 vmware-root_918-2697532712
3、查看普通用户的家目录的所有内容
[root@haha ~]# ls -a /home/redhat/
. .. .bash_history .bash_logout .bash_profile .bashrc
4、切换到 log 目录,log 目录在 /var 下,并且查看当前目录
[root@haha ~]# cd /var/log
[root@haha log]# pwd
/var/log
5、以年 - 月 - 日 时:分: 秒 的格式显示当前时间
[root@haha ~]# date "+%Y-%m-%d %H:%M:%S"
2026-07-21 14:47:32
6、只查看当前的星期
[root@haha ~]# date +%A
星期二
7、查看当前的时区
[root@haha ~]# timedatectl status
Local time: 二 2026-07-21 14:50:58 CST
Universal time: 二 2026-07-21 06:50:58 UTC
RTC time: 二 2026-07-21 06:50:59
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
8、从 redhat 用户切换到 root 用户,并且切换的时候切换家目录
[redhat@haha ~]$ su - root
密码:
[root@haha ~]# pwd
/root
9、通过 --help 查看 date 命令的帮助信息,并找到命令格式是啥
[root@haha ~]# date --help
用法:date [选项]... [+格式]
或:date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
以给定<格式>字符串的形式显示当前时间,或者设置系统日期。
10、修改自己的主机名为自己名字的缩写
[root@haha ~]# hostnamectl hostname hyl
[root@haha ~]# hostnamectl
Static hostname: hyl
Icon name: computer-vm
Chassis: vm ??
Machine ID: 684a3a9229ef43e3a67adfa72b2922f9
Boot ID: e01a46e4fc9c4d16bff8c80040d91f21
Virtualization: vmware
Operating System: Red Hat Enterprise Linux 9.8 (Plow)
CPE OS Name: cpe:/o:redhat:enterprise_linux:9::baseos
Kernel: Linux 5.14.0-687.5.3.el9_8.x86_64
Architecture: x86-64
Hardware Vendor: VMware, Inc.
Hardware Model: VMware Virtual Platform
Firmware Version: 6.00