第三章_Linux环境基础开发工具使用

1.Linux 软件包管理器 yum

简单尝试在root用户下安装一个小程序

[root@VM-12-12-centos ~]# yum install sl      //按回车


Is this ok [y/d/N]: y                         //按回车

输入sl命令,屏幕上会出现一辆小火车 

2.yum list 命令

通过 yum list 命令可以罗列出当前一共有哪些软件包

-bash-4.2$ yum list
由于包的数目可能非常之多 , 这里我们需要使用 grep 命令只筛选出我们关注的包. 例如查找 lrzsz 安装包
-bash-4.2$ yum list | grep lrzsz
lrzsz.x86_64                             0.12.20-36.el7                @os  

发现确实有这个安装包,接下来安装这个安装包(注意要在root用户下安装)。

[root@VM-12-12-centos ~]#  yum install lrzsz
yum 会自动找到都有哪些软件包需要下载 , 这时候敲 " y " 确认安装 .
出现 "complete" 字样 , 说明安装完成。

再安装一个软件源

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
//回车


Is this ok [y/d/N]: y
//回车

Installed:
  epel-release.noarch 0:7-14                                                            

Complete!

3. 安装vim

输入

[root@VM-12-12-centos ~]# yum install -y vim

安装好后,输入vim命令查看安装的版本

[root@VM-12-12-centos ~]# vim

 按shift+:(冒号),再按q+enter键退出。

4.使用vim进行首次编辑

1.创建test01.c文件,2.使用vim编辑test01.c文件

-bash-4.2$ touch test01.c
-bash-4.2$ ls
test01.c
-bash-4.2$ vim test01.c

2.进入文件后,是默认的“命令模式”,按“i”进入“插入模式”便可以进行编辑

3.编辑结束后,按“esc”键回到“命令模式”,再按“shift+:(冒号)”进入“底行模式”,输入“wq”再按回车键进行保存并退出。

4.输入 “cat test01.c”查看编辑的内容

-bash-4.2$ cat test01.c
#include <stdio.h>

int main()
{
printf("hello world\n");
return 0;
}

5.三种模式之间的关系

5. 命令模式下的文本操作

1. yy+p为复制

#include <stdio.h>
  3 
  4 int main()
  5 {
  6   printf("hello world\n");
  7   printf("hello world\n");
  8   printf("hello world\n");
  9   printf("hello world\n");                                                                                     
 10  return  0;
 11 }

2. yy+5p为复制5次

 #include <stdio.h>
  3 
  4 int main()
  5 {
  6   printf("hello world\n");
  7   printf("hello world\n");
  8   printf("hello world\n");
  9   printf("hello world\n");
 10   printf("hello world\n");
 11   printf("hello world\n");
 12   printf("hello world\n");                                                                                     
 13   printf("hello world\n");
 14   printf("hello world\n");
 15   printf("hello world\n");
 16   printf("hello world\n");
 17  return  0;
 18 }

3.(5)dd为剪切

2 #include <stdio.h>
  3 
  4 int main()
  5 {
  6   printf("hello world\n");
  7   printf("hello world\n");
  8   printf("hello world\n");
  9   printf("hello world\n");                                                                                     
 10  return  0;               
 11 } 

4. shift+g光标定位到文本末尾

#include <stdio.h>
  3 
  4 int main()
  5 {
  6   printf("hello world\n");
  7   printf("hello world\n");
  8   printf("hello world\n");
  9   printf("hello world\n");
 10  return  0;               
 11 }                                  //光标停留在文本末尾

<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值