第一
[root@localhost ~]# whoami
root
[root@localhost ~]# mkdir -p /root/test_dir
[root@localhost ~]# touch /root/test_dir/test_file.txt
[root@localhost ~]# ls -l /root/test_dir/test_file.txt
-rw-r--r--. 1 root root 0 10月 15 19:23 /root/test_dir/test_file.txt
[root@localhost ~]# cp /root/test_dir/test_file.txt /tmp/copy_of_test.txt
[root@localhost ~]# ls -l /tmp/copy_of_test.txt
-rw-r--r--. 1 root root 0 10月 15 19:23 /tmp/copy_of_test.txt
[root@localhost ~]# rm -rf ~/test_dir
[root@localhost ~]# mkdir ~/test_dir
[root@localhost ~]# touch ~/test_dir/test_file.txt
[root@localhost ~]# ln -s ~/test_dir/test_file.txt ~/test_dir/soft_link.txt
[root@localhost ~]# ln ~/test_dir/test_file.txt ~/test_dir/hard_link.txt
[root@localhost ~]# rm ~/test_dir/test_file.txt
rm:是否删除普通空文件 '/root/test_dir/test_file.txt'?y
[root@localhost ~]# cat ~/test_dir/soft_link.txt
cat: /root/test_dir/soft_link.txt: 没有那个文件或目录
[root@localhost ~]# cat ~/test_dir/hard_link.txt
第二
[root@localhost ~]# head -n 10 /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
[root@localhost ~]# echo "这是追加的测试内容" >> /tmp/copy_of_test.txt
[root@localhost ~]# cat /tmp/copy_of_test.txt
这是追加的测试内容
[root@localhost ~]# vim /tmp/copy_of_test.txt
# 在vim命令模式下输入:
:%s/测试/练习/g
:wq
[root@localhost ~]#
第三
[root@localhost ~]# mkdir /home/backup
mkdir: 无法创建目录 “/home/backup”: 文件已存在
[root@localhost ~]# cp /etc/*.conf /home/backup/
[root@localhost ~]# ls -1 /home/backup/ | wc -l
33
[root@localhost ~]# tar -czvf /home/etc_backup.tar.gz -C /home backup
backup/
backup/appstream.conf
backup/asound.conf
backup/brltty.conf
backup/chrony.conf
backup/dnsmasq.conf
backup/dracut.conf
backup/fprintd.conf
backup/fuse.conf
backup/host.conf
backup/kdump.conf
backup/krb5.conf
backup/ld.so.conf
backup/libaudit.conf
backup/libuser.conf
backup/locale.conf
backup/logrotate.conf
backup/man_db.conf
backup/mke2fs.conf
backup/nsswitch.conf
backup/pbm2ppa.conf
backup/pnm2ppa.conf
backup/resolv.conf
backup/rsyncd.conf
backup/rsyslog.conf
backup/sestatus.conf
backup/sudo.conf
backup/sudo-ldap.conf
backup/sysctl.conf
backup/updatedb.conf
backup/usb_modeswitch.conf
backup/vconsole.conf
backup/xattr.conf
backup/yum.conf
[root@localhost ~]# rm -rf /home/backup
第四
[root@localhost ~]# chown user1:group1 /tmp/copy_of_test.txt
[root@localhost ~]# chmod 754 /tmp/copy_of_test.txt
[root@localhost ~]# ls -l /tmp/copy_of_test.txt
-rwxr-xr--. 1 user1 group1 28 10月 15 19:29 /tmp/copy_of_test.txt
第五
[root@localhost ~]# useradd -s /bin/bash newuser1
useradd:用户“newuser1”已存在
[root@localhost ~]# groupadd newgroup1
groupadd:“newgroup1”组已存在
[root@localhost ~]# usermod -aG newgroup1 newuser1
[root@localhost ~]# userdel newuser1
第六
[root@localhost ~]# mkdir ~/perm_test_dir
[root@localhost ~]# touch ~/perm_test_dir/perm_test_file.txt
[root@localhost ~]# chmod 750 ~/perm_test_dir
[root@localhost ~]# chmod 644 ~/perm_test_dir/perm_test_file.txt
[root@localhost ~]# chown :newgroup1 -R ~/perm_test_dir
[root@localhost ~]# chmod -R 775 ~/perm_test_dir
第七
[root@localhost ~]# sudo dnf install cockpit -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
上次元数据过期检查:0:24:38 前,执行于 2025年10月15日 星期三 19时18分15秒。
软件包 cockpit-300.1-1.el9_3.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!
[root@localhost ~]# sudo systemctl enable --now cockpit.socket
[root@localhost ~]# sudo firewall-cmd --add-service=cockpit --permanent
Warning: ALREADY_ENABLED: cockpit
success
[root@localhost ~]# sudo firewall-cmd --reload
success
[root@localhost ~]#
第八
vim test.txt
# 命令模式下输入:
3G5l
2G #移动到第2行
dd # 删除当前行
u # 撤销
gg # 移动到文件开头
2yy # 复制前两行
G # 移动到文件末尾
p # 粘贴
:w # 保存
/Linux # 查找
:%s/Linux//gn # 统计次数
:%s/Linux/RHEL系统/gc
(6) 查找以"LOGO"开头的行
/^LOGO
1744

被折叠的 条评论
为什么被折叠?



