@@ -413,27 +413,27 @@ Linux系统的命令通常都是如下所示的格式:
413
413
414
414
```Shell
415
415
416
- [root@iZwz97tbgo9lkabnat2lo8Z ~]# cat 1 .txt
416
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# cat foo .txt
417
417
grape
418
418
apple
419
419
pitaya
420
- [root@iZwz97tbgo9lkabnat2lo8Z ~]# cat 2 .txt
420
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# cat bar .txt
421
421
100
422
422
200
423
423
300
424
424
400
425
- [root@iZwz97tbgo9lkabnat2lo8Z ~]# paste 1 .txt 2 .txt
425
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# paste foo .txt bar .txt
426
426
grape 100
427
427
apple 200
428
428
pitaya 300
429
429
400
430
- [root@iZwz97tbgo9lkabnat2lo8Z ~]# paste 1 .txt 2 .txt > 3 .txt
431
- [root@iZwz97tbgo9lkabnat2lo8Z ~]# cut -b 4-8 3 .txt
430
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# paste foo .txt bar .txt > hello .txt
431
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# cut -b 4-8 hello .txt
432
432
pe 10
433
433
le 20
434
434
aya 3
435
435
0
436
- [root@iZwz97tbgo9lkabnat2lo8Z ~]# cat 3 .txt | tr ' \t ' ' ,'
436
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# cat hello .txt | tr ' \t ' ' ,'
437
437
grape,100
438
438
apple,200
439
439
pitaya,300
@@ -662,16 +662,16 @@ Linux系统的命令通常都是如下所示的格式:
662
662
663
663
### 编辑器vim
664
664
665
- 1. 启动vim。
665
+ 1. 启动vim。可以通过`vi`或`vim`命令来启动vim,启动时可以指定文件名来打开一个文件,如果没有指定文件名,也可以在保存的时候指定文件名。
666
666
667
667
```Shell
668
668
669
669
[root@iZwz97tbgo9lkabnat2lo8Z ~]# vim guess.py
670
670
```
671
671
672
- 2. 命令模式、编辑模式和末行模式:启动vim进入的是命令模式,在命令模式下输入英文字母`i`会进入编辑模式,屏幕下方出现`-- INSERT --`提示;在编辑模式下按下`Esc`会回到命令模式,此时如果输入英文`:`会进入末行模式,在末行模式下输入`q!`可以在不保存当前工作的情况下强行退出vim,如果希望执行保存退出,则应该在末行模式下输入`wq` 。
672
+ 2. 命令模式、编辑模式和末行模式:启动vim进入的是命令模式(也称为Normal模式) ,在命令模式下输入英文字母`i`会进入编辑模式(Insert模式) ,屏幕下方出现`-- INSERT --`提示;在编辑模式下按下`Esc`会回到命令模式,此时如果输入英文`:`会进入末行模式,在末行模式下输入`q!`可以在不保存当前工作的情况下强行退出vim;在命令模式下输入`v`会进入可视模式(Visual模式),可以用光标选择一个区域再完成对应的操作 。
673
673
674
- 3. 退出vim :在命令模式下输入`:` 进入末行模式,输入wq可以实现保存退出 ;如果想放弃编辑的内容输入`q!`强行退出,这一点刚才已经提到过了;在命令模式下也可以直接输入`ZZ`实现保存退出。
674
+ 3. 保存和退出vim :在命令模式下输入`:` 进入末行模式,输入`wq`可以实现保存退出 ;如果想放弃编辑的内容输入`q!`强行退出,这一点刚才已经提到过了;在命令模式下也可以直接输入`ZZ`实现保存退出。如果只想保存文件不退出,那么可以在末行模式下输入`w`;可以在`w`后面输入空格再指定要保存的文件名 。
675
675
676
676
4. 光标操作。
677
677
@@ -715,17 +715,18 @@ Linux系统的命令通常都是如下所示的格式:
715
715
716
716
```Shell
717
717
718
- [root@iZwz97tbgo9lkabnat2lo8Z ~]# vim -d 1 .txt 2.txt 3 .txt
718
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# vim -d foo .txt bar .txt
719
719
```
720
+ 
720
721
721
722
- 打开多个文件。
722
723
723
724
```Shell
724
725
725
- [root@iZwz97tbgo9lkabnat2lo8Z ~]# vim 1 .txt 2 .txt 3 .txt
726
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# vim foo .txt bar .txt hello .txt
726
727
```
727
728
728
- 启动vim后只有一个窗口显示的是1 .txt,可以在末行模式中输入`ls`查看到打开的三个文件,也可以在末行模式中输入`b <num>`来显示另一个文件,例如可以用`:b 2`来显示2.txt 。
729
+ 启动vim后只有一个窗口显示的是foo .txt,可以在末行模式中输入`ls`查看到打开的三个文件,也可以在末行模式中输入`b <num>`来显示另一个文件,例如可以用`:b 2`将bar.txt显示出来,可以用`:b 3`将hello.txt显示出来 。
729
730
730
731
- 拆分和切换窗口。
731
732
@@ -742,7 +743,7 @@ Linux系统的命令通常都是如下所示的格式:
742
743
743
744
`:inoremap __main if __name__ == ' __main__' :`
744
745
745
- > 说明:如果希望映射的快捷键每次启动vim时都能生效,需要将映射写到用户主目录下的.vimrc文件中。
746
+ > 说明:上面例子2的`inoremap`中的`i`表示映射的键在编辑模式使用, `nore`表示不要递归,这一点非常重要,否则如果键对应的内容中又出现键本身,就会引发递归(相当于进入了死循环)。 如果希望映射的快捷键每次启动vim时都能生效,需要将映射写到用户主目录下的.vimrc文件中。
746
747
747
748
- 录制宏。
748
749
@@ -800,15 +801,59 @@ Dependency Installed:
800
801
nginx-mod-mail.x86_64 1:1.12.2-2.el7
801
802
nginx-mod-stream.x86_64 1:1.12.2-2.el7
802
803
Complete!
804
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# yum info nginx
805
+ Loaded plugins: fastestmirror
806
+ Loading mirror speeds from cached hostfile
807
+ Installed Packages
808
+ Name : nginx
809
+ Arch : x86_64
810
+ Epoch : 1
811
+ Version : 1.12.2
812
+ Release : 2.el7
813
+ Size : 1.5 M
814
+ Repo : installed
815
+ From repo : epel
816
+ Summary : A high performance web server and reverse proxy server
817
+ URL : http://nginx.org/
818
+ License : BSD
819
+ Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
820
+ : IMAP protocols, with a strong focus on high concurrency, performance and low
821
+ : memory usage.
803
822
[root@iZwz97tbgo9lkabnat2lo8Z ~]# nginx -v
804
823
nginx version: nginx/1.12.2
805
824
```
806
825
807
- 下面以MySQL为例,演示如何使用rpm安装软件。
826
+ 下面以MySQL为例,演示如何使用rpm安装软件。要安装MySQL需要先到[MySQL官方网站](https://www.mysql.com/)下载对应的[RPM文件](https://dev.mysql.com/downloads/mysql/),当然要选择和你使用的Linux系统对应的版本。MySQL现在是Oracle公司旗下的产品,在MySQL被收购后,MySQL的作者重新制作了一个MySQL的分支MariaDB,可以通过yum进行安装。如果要安装MySQL需要先通过yum删除`mariadb-libs`这个可能会跟MySQL底层库冲突的库,然后还需要安装一个名为`libaio`的依赖库。
808
827
809
828
```Shell
810
829
811
-
830
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# ls
831
+ mysql-community-client-5.7.22-1.el7.x86_64.rpm
832
+ mysql-community-common-5.7.22-1.el7.x86_64.rpm
833
+ mysql-community-libs-5.7.22-1.el7.x86_64.rpm
834
+ mysql-community-server-5.7.22-1.el7.x86_64.rpm
835
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# yum -y remove mariadb-libs
836
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# yum -y install libaio
837
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
838
+ warning: mysql-community-common-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
839
+ Preparing... ################################# [100%]
840
+ package mysql-community-common-5.7.22-1.el7.x86_64 is already installed
841
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm
842
+ warning: mysql-community-libs-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
843
+ Preparing... ################################# [100%]
844
+ package mysql-community-libs-5.7.22-1.el7.x86_64 is already installed
845
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm
846
+ warning: mysql-community-client-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
847
+ Preparing... ################################# [100%]
848
+ package mysql-community-client-5.7.22-1.el7.x86_64 is already installed
849
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm
850
+ warning: mysql-community-server-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
851
+ Preparing... ################################# [100%]
852
+ package mysql-community-server-5.7.22-1.el7.x86_64 is already installed
853
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# mysqld --version
854
+ mysqld Ver 5.7.22 for Linux on x86_64 (MySQL Community Server (GPL))
855
+ [root@iZwz97tbgo9lkabnat2lo8Z mysql]# mysql --version
856
+ mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
812
857
```
813
858
814
859
#### 下载解压配置环境变量
@@ -858,6 +903,16 @@ git version: a20ecd3e3a174162052ff99913bc2ca9a839d618
858
903
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
859
904
allocator: tcmalloc
860
905
modules: none
906
+ build environment:
907
+ distmod: rhel70
908
+ distarch: x86_64
909
+ target_arch: x86_64
910
+ [root@iZwz97tbgo9lkabnat2lo8Z ~]# mongo --version
911
+ MongoDB shell version v3.6.5
912
+ git version: a20ecd3e3a174162052ff99913bc2ca9a839d618
913
+ OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
914
+ allocator: tcmalloc
915
+ modules: none
861
916
build environment:
862
917
distmod: rhel70
863
918
distarch: x86_64
0 commit comments