RHCSA第一次作业
创始人
2024-11-13 09:41:14
0

目录

1、创建以上目录和文件结构,并将/yasuo目录拷贝4份到/目录下

2、查看系统合法shell

3、查看系统发行版版本

4、查看系统内核版本

5、临时修改主机名

6、为/yasuo/ssh_config文件创建软链接/ssh_config.link到/mulu下

8、找到你的根目录下的所有块设备文件

9、将/etc/passwd和/etc/ssh/sshd_config文件复制到/root/etc/目录下

10、复制/var/log/messages到/root目录下

11、创建目录/dir1,复制/etc/passwd文件到该目录

12、将/dir1/passwd重命名为passwd.back

13、列出目录/root和/aaaaa,将标准输出重定向到ok.file,标准错误输出重定向到erro.file

14、列出目录/root和/aaaaa,将标准输出和标准错误输出都丢掉

15、在/根目录下创建一个haha目录

16、在/根目录下创建xixi文件

17、往xixi文件里面写'wo shi xixi ^=^'

19将xixi.link重命名为xixi.link2.0

20、使用vim编辑器完成以下步骤:

(1)应用vim命令在/tmp文件夹下创建文件,文件名newfile。在newfile首行输入日期时间

(2)将/boot/grub2/grub.cfg文档的内容读入到newfile文档中(在日期的下一行即第2行)

(3) 查找newfile文档中包含#号字符的行,将整行删除

(4) 开启VI的行号提示功能


1、创建以上目录和文件结构,并将/yasuo目录拷贝4份到/目录下

[root@localhost ~]# ls /yasuo               // 先检查是否有yasuo目录
ls: 无法访问 '/yasuo': 没有那个文件或目录
[root@localhost ~]# mkdir -p /yasuo/dir1     // 递归创建目录
[root@localhost ~]# tree /yasuo
/yasuo
└── dir1

1 directory, 0 files
[root@localhost ~]# cp /etc/hostname   /yasuo/dir1/        // 拷贝文件
[root@localhost ~]# cp /etc/hostname   /yasuo/dir1/hostname02
[root@localhost ~]# cp /etc/passwd   /yasuo/dir1/
[root@localhost ~]# cp /etc/ssh/ssh_config   /yasuo/dir1/
[root@localhost ~]# cp /etc/ssh/ssh_config   /yasuo/dir1/sshd
[root@localhost ~]# tree /yasuo/
/yasuo/
└── dir1
    ├── hostname
    ├── hostname02
    ├── passwd
    ├── ssh_config
    └── sshd

1 directory, 5 files
[root@localhost ~]# cp /yasuo/dir1/*   /yasuo/          
[root@localhost ~]# tree /yasuo/
/yasuo/
├── dir1
│     ├── hostname
│     ├── hostname02
│     ├── passwd
│     ├── ssh_config
│     └── sshd
├── hostname
├── hostname02
├── passwd
├── ssh_config
└── sshd

1 directory, 10 files
[root@localhost ~]# 
 

2、查看系统合法shell

[root@localhost ~]# echo $SHELL

/bin/bash

3、查看系统发行版版本

[root@localhost ~]# cat  /etc/redhat-release
Red Hat Enterprise Linux release 9.3 (Plow)

4、查看系统内核版本

[root@localhost ~]# uname  -r
5.14.0-362.8.1.el9_3.x86_64

5、临时修改主机名

[root@localhost ~]# hostname haha   // 临时修改

[root@localhost ~]# hostnamectl  hostname haha   // 永久修改

6、为/yasuo/ssh_config文件创建软链接/ssh_config.link到/mulu下

[root@hahaha ~]# ls -li  /mulu           // 首先查看mulu在不在
ls: 无法访问 '/mulu': 没有那个文件或目录
[root@hahaha ~]# mkdir  /mulu                 // 创建目录
[root@hahaha ~]# ln -s /yasuo/ssh_config  /mulu/ssh_config.link  // 创建软连接
[root@hahaha ~]# ls -li /yasuo/ssh_config  /mulu
36068157 -rw-r--r--. 1 root root 1921  8月  1 18:30 /yasuo/ssh_config

/mulu:
总用量 0
878306 lrwxrwxrwx. 1 root root 17  8月  2 12:25 ssh_config.link -> /yasuo/ssh_config

[root@hahaha ~]# mv /mulu /yasuo/mulu1 
[root@hahaha ~]# ls /yasuo/mulu1
root  ssh_config.link

8、找到你的根目录下的所有块设备文件

[root@hahaha ~]# find / -type b
/dev/dm-1
/dev/dm-0
/dev/sr0
/dev/nvme0n1p3
/dev/nvme0n1p2
/dev/nvme0n1p1
/dev/nvme0n1
/run/user/0/systemd/inaccessible/blk
/run/systemd/inaccessible/blk

9、将/etc/passwd和/etc/ssh/sshd_config文件复制到/root/etc/目录下

[root@hahaha ~]# cp /etc/passwd /root/etc/
cp: 无法创建普通文件'/root/etc/': 没有那个文件或目录
[root@hahaha ~]# mkdir -p /root/etc
[root@hahaha ~]# ls /root/etc      # 新创建的/root/etc内没有任何文件
[root@hahaha ~]# 
[root@hahaha ~]# cp /etc/passwd  /root/etc/
[root@hahaha ~]# cp /etc/ssh/ssh_config  /root/etc/
[root@hahaha ~]# ls /root/etc
passwd  ssh_config

10、复制/var/log/messages到/root目录下

[root@hahaha ~]# ls /var/log/messages 
/var/log/messages
[root@hahaha ~]# cp /var/log/messages  /root
[root@hahaha ~]# ls /root
etc  messages

11、创建目录/dir1,复制/etc/passwd文件到该目录

[root@hahaha ~]# mkdir /dir1
[root@hahaha ~]# cp /etc/passwd  /dir1

12、将/dir1/passwd重命名为passwd.back

[root@hahaha ~]# mv /passwd /passwd.back
[root@hahaha ~]# ls /passwd
ls: 无法访问 '/passwd': 没有那个文件或目录
[root@hahaha ~]# ls /passwd.back 
/passwd.back

13、列出目录/root和/aaaaa,将标准输出重定向到ok.file,标准错误输出重定向到erro.file

root@hahaha ~]#  ls -l /root  /aaaaa   1> /root/ok.file  2>/root/erro.file

root@hahaha ~]# ls -l /root /aaaaa
ls: 无法访问 '/aaaaa': 没有那个文件或目录
/root:
总用量 520
-rw-r--r--. 1 root root     55  8月  2 13:14 erro.file
drwxr-xr-x. 2 root root     38  8月  2 12:47 etc
-rw-------. 1 root root 522894  8月  2 12:54 messages
-rw-r--r--. 1 root root    236  8月  2 13:14 ok.file
[root@hahaha ~]# cat /root/ok.file
/root:
总用量 516
-rw-r--r--. 1 root root     55  8月  2 13:14 erro.file
drwxr-xr-x. 2 root root     38  8月  2 12:47 etc
-rw-------. 1 root root 522894  8月  2 12:54 messages
-rw-r--r--. 1 root root      0  8月  2 13:14 ok.file
[root@hahaha ~]# cat /root/erro.file
ls: 无法访问 '/aaaaa': 没有那个文件或目录

14、列出目录/root和/aaaaa,将标准输出和标准错误输出都丢掉

[root@hahaha ~]# ls -l /root /aaaaa &>/dev/null

15、在/根目录下创建一个haha目录

[root@hahaha ~]# mkdir /root/haha

[root@hahaha ~]# ll /root/haha
总用量 0

16、在/根目录下创建xixi文件

[root@hahaha ~]# touch /root/xixi
[root@hahaha ~]# ll /root/xixi
-rw-r--r--. 1 root root 0  8月  2 13:21 /root/xixi

17、往xixi文件里面写'wo shi xixi ^=^'

[root@hahaha ~]# echo  'wo shi xixi ^=^'  >  /xixi
[root@hahaha ~]# cat /xixi
wo shi xixi ^=^

[root@hahaha ~]# mkdir  /mulu
[root@hahaha ~]# ln -s  /root/xixi  /mulu/xixi.link
[root@hahaha ~]# ls -li  /mulu/xixi.link
18939533 lrwxrwxrwx. 1 root root 10  8月  2 13:28 /mulu/xixi.link -> /root/xixi

19将xixi.link重命名为xixi.link2.0

[root@hahaha ~]# mv  /mulu/xixi.link   /xixi.link2.0
[root@hahaha ~]# ls -li /xixi.link
ls: 无法访问 '/xixi.link': 没有那个文件或目录

[root@hahaha ~]# ls -li /xixi.link2.0
18939533 lrwxrwxrwx. 1 root root 10  8月  2 13:28 /xixi.link2.0 -> /root/xixi
 

20、使用vim编辑器完成以下步骤:

(1)应用vim命令在/tmp文件夹下创建文件,文件名newfile。在newfile首行输入日期时间

[root@hahaha ~]# touch /tmp/newfile

[root@hahaha ~]# vim /tmp/newfile   // 进入到vi编辑器,按“a 、i、o”进入插入模式即可输入日期时间

(2)将/boot/grub2/grub.cfg文档的内容读入到newfile文档中(在日期的下一行即第2行)

按esc键进入命令模式,再按“ : ”进入末行模式,用命令"r(空格)/(文件路径)"读入文档内容

:r /boot/grub2/grub.cfg

(3) 查找newfile文档中包含#号字符的行,将整行删除

‘ :’进入末行模式输入命令“g/搜索目标/d”

:g/#/d

(4) 开启VI的行号提示功能

进入末行模式输入命令“set nu”开启行号提示功能

:set nu

最后在末行模式输入:wq 保存退出

相关内容

热门资讯

必备教程!云扑克德州辅助器(黑... 必备教程!云扑克德州辅助器(黑科技)外挂ai代打辅助助手(果真有挂)-哔哩哔哩是一款可以让一直输的玩...
黑科技辅助(aapoker德州... 您好,aapoker德州线上这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】...
黑科技真的!德州ai机器人辅助... 黑科技真的!德州ai机器人辅助(透视)科技教程(2021已更新)(哔哩哔哩)1、很好的工具软件,可以...
黑科技数据(众合推扑克辅助器)... 黑科技数据(众合推扑克辅助器)外挂透明挂辅助器(透视)一直真的是有挂(有挂秘诀)-哔哩哔哩1、点击下...
盘点一款!!aapoker有伙... 盘点一款!!aapoker有伙牌吗(黑科技)外挂透明黑科技辅助器(有挂猫腻)-哔哩哔哩;盘点一款!!...
黑科技讲解(wepoke好牌)... 黑科技讲解(wepoke好牌)外挂透明挂辅助软件(透明黑科技)其实是有挂(有挂秘籍)-哔哩哔哩wep...
黑科技新版!扑克时间辅助软件(... 黑科技新版!扑克时间辅助软件(透视)透明挂教程(2021已更新)(哔哩哔哩)该软件可以轻松地帮助玩家...
黑科技游戏(wpk有猫腻吗)外... 黑科技游戏(wpk有猫腻吗)外挂透明挂辅助插件(透视)真是有挂(发现有挂)-哔哩哔哩1、打开软件启动...
最新研发!微扑克wpk辅助(黑... 最新研发!微扑克wpk辅助(黑科技)外挂智能ai辅助神器(新版有挂)-哔哩哔哩;人气非常高,ai更新...
黑科技线上!aa扑克有外挂吗(... 黑科技线上!aa扑克有外挂吗(透视)必胜教程(2021已更新)(哔哩哔哩)1、aa扑克有外挂吗ai机...