加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

进入编辑模式、vim命令模式、vim实践

发布时间:2020-12-15 09:20:40 所属栏目:安全 来源:网络整理
导读:进入编辑模式 1、[root@test ~]# vi /etc/services 2、输入小写的i后再下发就会出现--INSERT--,就可以编辑 # # Each line describes one service,and is of the form: # # service-name port/protocol [aliases ...] [# comment] -- INSERT -- 3、可以在光

进入编辑模式

1、[root@test ~]# vi /etc/services

2、输入小写的i后再下发就会出现--INSERT--,就可以编辑

#

# Each line describes one service,and is of the form:

#

# service-name port/protocol [aliases ...] [# comment]


-- INSERT --


3、可以在光标下新增一行,用小写的o


vim命令模式

1、查找

/even

# Each line describes one service,and is of the form:


#

# service-name port/protocol [aliases ...] [# comment]

/even


2、按n选择下一个(向下查找)

3、输入?even 选择n向前查找

4、将所有的even字符替换成test,若是不加g的话,就只替换第一行

:1,$s/enev/test/g

5、:1,955s/zserv/test/g,在1行到955行替换


vim实践

1、[root@test ~]# cp /etc/services /temp/1.txt

2、需要查看45行

:45

3、删除一行

dd

删除3行

3dd

4、还原上一步

u

5、移动到最后一行

G

6、移动到行首

gg

7、复制2行

2yy

8、粘贴

p

9、按u恢复上一步,按Ctrl+r 相反

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读