当前位置:网站首页>Rhcsa Road
Rhcsa Road
2022-07-01 16:34:00 【Omniscient magical conch】
Day three homework
1、 Sum up vim Of the three modes, the commands you think are practical
Command mode :
^ Head of line
$ At the end of the line
yy Copy
4yy Copy a total of four lines starting from the cursor
cc shear
4cc Cut a total of four lines starting from the cursor
p Paste ( Paste on the next line of the cursor )
Last row mode :
:q sign out
:w preservation
:10 Jump to line 10
:%s % Match symbol
Insertion mode :
o Enter insertion mode , Add content on the next line of the cursor
O Enter insertion mode , Add content on the line above the cursor
a Insert content after cursor
2、 File management command exercise :
stay /opt Create a temporary directory under the directory tmp;
Create a file in the temporary directory , The file named a.txt;
take a.txt Copy it into b.txt; take b.txt Change its name to c.txt;
Create symbolic links , The linked file name is linkc.txt;
[[email protected] ~]# mkdir -p /opt/tmp
[[email protected] ~]# touch /opt/tmp a.txt
[[email protected] ~]# cp /opt/tmp/a.txt /opt/tmp/b.txt
cp: cannot stat '/opt/tmp/a.txt': No such file or directory
[[email protected] ~]# cp /opt/tmp/a.txt /opt/tmp/b.txt -p
cp: cannot stat '/opt/tmp/a.txt': No such file or directory
[[email protected] ~]# cp -p /opt/tmp/a.txt /opt/tmp/b.txt
cp: cannot stat '/opt/tmp/a.txt': No such file or directory
[[email protected] ~]# ll /opt/tmp
total 0
[[email protected] ~]# touch /opt/tmp/a.txt
[[email protected] ~]# ll /opt/tmp
total 0
-rw-r--r--. 1 root root 0 Feb 13 06:32 a.txt
[[email protected] ~]# cp -p /opt/tmp/a.txt /opt/tmp/b.txt
[[email protected] ~]# ll /opt/tmp
total 0
-rw-r--r--. 1 root root 0 Feb 13 06:32 a.txt
-rw-r--r--. 1 root root 0 Feb 13 06:32 b.txt
[[email protected] ~]# mv /opt/tmp/b.txt /opt/tmp/c.txt
[[email protected] ~]# ll /opt/tmp
total 0
-rw-r--r--. 1 root root 0 Feb 13 06:32 a.txt
-rw-r--r--. 1 root root 0 Feb 13 06:32 c.txt
[[email protected] ~]# ln -s /opt/tmp/c.txt linkc.txt
[[email protected] ~]# ll
total 8
lrwxrwxrwx. 1 root root 14 Feb 13 06:35 linkc.txt -> /opt/tmp/c.txt
3、vi practice : Complete the following steps
1) application vi Command in /tmp Create files under folders , file name newfile. stay newfile Enter the date and time on the first line
2) take /boot/grub2/grub.cfg The contents of the document are read into newfile In the document ( On the next line of the date, i.e 2 That's ok )
3) Find documents that contain # The line of the sign character , Delete entire line
4) Turn on VI Line number prompt function
5) Move the cursor to 5 That's ok , And in the first place 5 A new blank line is generated after the line 6 That's ok
6) Modify the content . Will all timeout=5, Change to time=30
7) All... In the entire document root The character is changed to admin character
8) Copy No 1 The date and time content of the line to the end of the document
9) Save the document , Save the document again as /boot/newfile2, sign out VI Editor
[[email protected] ~]# mkdir -p /tmp
[[email protected] ~]# touch /tmp/newfile
[[email protected] ~]# date > /tmp/newfile
[[email protected] ~]# cat /tmp/newfile
Sun Feb 13 06:47:38 EST 2022
[[email protected] ~]# cat /boot/grub2/grub.cfg > /tmp/newfile
[[email protected] ~]# cat /tmp/newfile
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
[[email protected] ~]# vi /tmp/newfile
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set pager=1
if [ -f ${config_directory}/grubenv ]; then
load_env -f ${config_directory}/grubenv
elif [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
:g/#
#
if [ "${menu_show_once}" ]; then
unset menu_show_once
save_env menu_show_once
set timeout_style=menu
set timeout=60
elif [ "${menu_auto_hide}" -a "${menu_hide_ok}" = "1" ]; then
set orig_timeout_style=${timeout_style}
set orig_timeout=${timeout}
if [ "${fastboot}" = "1" ]; then
set timeout_style=menu
set timeout=0
else
set timeout_style=hidden
set timeout=1
fi
fi
fi
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
125 if [ "${menu_show_once}" ]; then
126 unset menu_show_once
127 save_env menu_show_once
128 set timeout_style=menu
129 set timeout=60
130 elif [ "${menu_auto_hide}" -a "${menu_hide_ok}" = "1" ]; then
131 set orig_timeout_style=${timeout_style}
132 set orig_timeout=${timeout}
133 if [ "${fastboot}" = "1" ]; then
134 set timeout_style=menu
135 set timeout=0
136 else
137 set timeout_style=hidden
138 set timeout=1
139 fi
140 fi
141 fi
142
143
144
145
146
147
148 if [ -f ${config_directory}/custom.cfg ]; then
149 source ${config_directory}/custom.cfg
150 elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
151 source $prefix/custom.cfg;
152 fi
:set nu
1
2 set pager=1
3
4 if [ -f ${config_directory}/grubenv ]; then
5 load_env -f ${config_directory}/grubenv
6
7 elif [ -s $prefix/grubenv ]; then
8 load_env
9 fi
10 if [ "${next_entry}" ] ; then
11 set default="${next_entry}"
12 set next_entry=
13 save_env next_entry
14 set boot_once=true
15 else
16 set default="${saved_entry}"
17 fi
18
19 if [ x"${feature_menuentry_id}" = xy ]; then
20 menuentry_id_option="--id"
21 else
22 menuentry_id_option=""
23 fi
24
25 export menuentry_id_option
26
27 if [ "${prev_saved_entry}" ]; then
28 set saved_entry="${prev_saved_entry}"
First in last line mode , Then input 5o, Press next o, Then exit the last line mode
59 set time=30
60 else
61 set time=30
62 fi
63
64 set tuned_params=""
65 set tuned_initrd=""
First in last line mode , Input %s/timeout=50/time=30/g
93 search --no-floppy --fs-uuid --set=admin ff7463e5-8537-4a9d-b465-29dfdb3ed8d5
94 fi
95 insmod part_msdos
96 insmod xfs
97 set boot='hd0,msdos1'
98 if [ x$feature_platform_search_hint = xy ]; then
99 search --no-floppy --fs-uuid --set=boot --hint='hd0,msdos1' ff7463e5-8537-4a9d-b465-29dfdb3ed8d5
100 else
101 search --no-floppy --fs-uuid --set=boot ff7463e5-8537-4a9d-b465-29dfdb3ed8d5
102 fi
103
104
105 if [ -z "${kernelopts}" ]; then
106 set kernelopts="admin=/dev/mapper/rhel-admin ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/a dmin rd.lvm.lv=rhel/swap rhgb quiet "
107 fi
108
109 insmod blscfg
110 blscfg
111
112 if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then
113 set menu_hide_ok=1
114 else
115 set menu_hide_ok=0
116 fi
117 if [ "${boot_success}" = "1" ] ; then
118 set boot_indeterminate=0
119 elif [ "${boot_indeterminate}" = "1" ]; then
8 substitutions on 6 lines
Method as above
Sun Feb 13 07:24:53 EST 2022
Sun Feb 13 07:24:53 EST 2022
~
~
:1 copy $
Because there is no time to see the first line in the original document , So save and exit , Then import the time to the first line , After entering the document, I think of the overwrite , So it shows the above appearance
Sun Feb 13 07:24:53 EST 2022
Sun Feb 13 07:24:53 EST 2022
~
~
~
:wq /boot/newfile2
[[email protected] ~]# cat /boot/newfile2
Sun Feb 13 07:24:53 EST 2022
Sun Feb 13 07:24:53 EST 2022
4、 The file to view
Copy user profile (/etc/passwd) To /opt Under the table of contents ;
see /opt/mima File first 6 That's ok ;
[[email protected] ~]# cp -a /etc/passwd /opt
[[email protected] ~]# ll /opt
total 4
-rw-r--r--. 1 root root 2554 Feb 10 14:42 passwd
[[email protected] ~]# head -3 /opt/passwd |tail -1
daemon:x:2:2:daemon:/sbin:/sbin/nologin
5. Statistics show user profiles (/etc/passwd)nologin Number of occurrences
[[email protected] ~]# cat /etc/passwd |grep nologin|wc -l
41
6. Displays the total number of users in the system
[[email protected] ~]# cat /etc/passwd | wc -l
46
7. Set the system time ( Minutes and seconds ) write in time file
[[email protected] ~]# date -s 21:06:50
Sun Feb 13 21:06:50 EST 2022
8.history The system command history can be displayed , Count the top three with the highest command frequency of the current system .( The command repeats three more commands )
[[email protected] ~]# history
1 cd
2 cd /
3 cd home
4 cd redhat
5 pwd
6 cd ~
7 pwd
8 cd redhat
9 cd /home/redhat
10 pwd
11 cls
12 ll
13 ifconfig
14 ip a
15 mkdir -p /opt/tmp
16 touch /opt/tmp a.txt
17 cp /opt/tmp/a.txt /opt/tmp/b.txt
18 cp /opt/tmp/a.txt /opt/tmp/b.txt -p
19 cp -p /opt/tmp/a.txt /opt/tmp/b.txt
20 ll /opt/tmp
21 touch /opt/tmp/a.txt
22 ll /opt/tmp
23 cp -p /opt/tmp/a.txt /opt/tmp/b.txt
24 ll /opt/tmp
25 mv /opt/tmp/b.txt /opt/tmp/c.txt
26 ll /opt/tmp
27 ln -s c.txt linc.txt
28 ll
29 rm linc.txt
30 ln -s /opt/tmp/c.txt linkc.txt
31 ll
32 rm linkc.txt
33 rm /opt
34 rm /opt -r
35 ll
36 rm a.txt
37 ll
38 rm /opt -r
39 ll
40 mkdir -p /tmp
41 touch /tmp/newfile
42 date
43 vi
44 ll /tmp/newfile
45 vi
46 vim /tmp/newfile
47 date > /tmp/file
48 date > /tmp/newfile
49 ll /tmp/newfile
50 cat /tmp/newfile
51 cat /boot/grub2/grub.cfg > /tmp/newfile
52 cat /tmp/newfile
53 grep -n # /tmp/newfile
54 grep # /tmp/newfile -n
55 grep -n # /tmp/newfile
56 vim /tmp/newfile
57 vi /tmp/newfile
58 grep -n '#' /tmp/newfile
59 grep -n '#' /tmp/newfiled
60 grep -n '#' d/tmp/newfile
61 vi /tmp/newfile
62 date > /tmp/newfile
63 vi /tmp/newfile
64 cat /boot/newfile2
65 rm /boot/newfile2
66 rm /tmp
67 rm -r /tmp
68 yy
69 y
70 yy
71 y
72 cat /etc/passwd
73 copy /etc/passwd /opt
74 cp -p /etc/passwd /opt
75 ll /opt
76 ll /opt/passwd
77 cat /opt/passwd
78 cp -a /etc/passwd /opt
79 ll /opt
80 cp -p /etc/passwd /opt
81 cat /opt/passwd
82 head -3 /opt/passwd
83 cat -n /opt/passwd
84 cp -a /etc/passwd /opt
85 cat -n /opt/passwd
86 cp -a /etc/passwd /opt
87 ll /opt
88 cp -p /etc/passwd /opt/
89 cp -p /etc/passwd /opt
90 ll /opt
91 cat /opt/passwd
92 cat /etc/passwd
93 cp -a /etc/passwd /opt
94 cat -a /opt/passwd
95 cat -p /opt/passwd
96 cat -n /opt/passwd
97 cp -a /etc/passwd /opt
98 ll /opt
99 mkdir -p /opt
100 cp -p /etc/passwd /opt
101 ll
102 ll /opt
103 cd /opt
104 cat -a /opt/passwd
105 cat -n /opt/passwd
106 vi /etc/passwd
107 wc -l /etc/passwd | cut -d "nologin" -f 1
108 cat /etc/passwd |grep nologin|wc -l
109 echo /etc/passwd |grep ' ' |wc -l
110 echo There are users in the current system \`wc -l /etc/passwd | cut -d " " -f 1` individual > file
111 q
112 EOf
113 EOF
114 cat /etc/passwd | wc -l
115 cat time
116 cat /etc/time
117 time
118 date -s 21:06:50
119 history
120 cat /etc/passwd
121 cp -a /etc/passwd /opt
122 rm -r /opt
123 mkdir -p /opt
124 cp -a /etc/passwd /opt
125 ll /opt
126 mv /etc/passwd /etc/passwd/mima
127 mv -p /etc/passwd /etc/passwd/mima
128 head -3 /opt/passwd
129 head -3 /opt/passwd |tail
130 head -3 /opt/passwd |tail -1
131 history
[[email protected] ~]# history | cut -d " " -f 5- | sort |uniq -c | sort -n | tail -3 | tr -s " " " " | cut -d " " -f 3-
ll /opt/tmp
ll /opt
ll
边栏推荐
- Red team Chapter 8: blind guess the difficult utilization process of the package to upload vulnerabilities
- Idea start command line is too long problem handling
- MLPerf Training v2.0 榜单发布,在同等GPU配置下百度飞桨性能世界第一
- IM即时通讯开发万人群聊消息投递方案
- PostgreSQL 存储结构浅析
- Talking from mlperf: how to lead the next wave of AI accelerator
- Go language source level debugger delve
- In the era of super video, what kind of technology will become the base?
- EndeavourOS移动硬盘安装
- laravel的模型删除后动作
猜你喜欢

【Hot100】17. Letter combination of telephone number

Do280 management application deployment - pod scheduling control

独家消息:阿里云悄然推出RPA云电脑,已与多家RPA厂商开放合作

Pico, do you want to save or bring consumer VR?

How to use MySQL language for row and column devices?
![[nodemon] app crashed - waiting for file changes before starting... resolvent](/img/ee/9830afd86e092851a2a906cb994949.png)
[nodemon] app crashed - waiting for file changes before starting... resolvent

Crypto Daily: Sun Yuchen proposed to solve global problems with digital technology on MC12

Endeavouros mobile hard disk installation
![[SQL statement] Why do you select two Shanghai and query different counts here? I want it to become a Shanghai, and count only displays a sum](/img/a4/58b942d1389834069e9a6ec9f8ee0a.png)
[SQL statement] Why do you select two Shanghai and query different counts here? I want it to become a Shanghai, and count only displays a sum

Défaillance lors du démarrage de la machine virtuelle VMware: le poste de travail VMware n'est pas compatible avec hyper - V...
随机推荐
Tutorial on principles and applications of database system (006) -- compiling and installing MySQL 5.7 (Linux Environment)
数据库系统原理与应用教程(006)—— 编译安装 MySQL5.7(Linux 环境)
SQLServer查询: a.id与b.id相同时,a.id对应的a.p在b.id对应的b.p里找不到的话,就显示出这个a.id和a.p
Principes et applications du système de base de données (006) - - compilation et installation de MySQL 5.7 (environnement Linux)
2023 spring recruitment Internship - personal interview process and face-to-face experience sharing
Do280 management application deployment - pod scheduling control
红队第8篇:盲猜包体对上传漏洞的艰难利用过程
Which MySQL functions are currently supported by tablestore in table storage?
Share the daily work and welfare of DJI (Shenzhen headquarters) in Dajiang
Zhou Shaojian, rare
数据库系统原理与应用教程(002)—— MySQL 安装与配置:MySQL 软件的卸载(windows 环境)
独家消息:阿里云悄然推出RPA云电脑,已与多家RPA厂商开放合作
虚拟串口模拟器和串口调试助手使用教程「建议收藏」
Where should older test / development programmers go? Will it be abandoned by the times?
How does go use symmetric encryption?
Malaysia's Star: Sun Yuchen is still adhering to the dream of digital economy in WTO MC12
怎么用MySQL语言进行行列装置?
How to write good code - Defensive Programming Guide
苹果自研基带芯片再次失败,说明了华为海思的技术领先性
红队第10篇:coldfusion反序列化过waf改exp拿靶标的艰难过程