Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
不正经的廖老师
Python-100-Days
提交
a748707c
P
Python-100-Days
项目概览
不正经的廖老师
/
Python-100-Days
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Python-100-Days
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a748707c
编写于
6月 22, 2018
作者:
骆昊的技术专栏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新了文档和资源
上级
fb7baa2d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
15 deletion
+70
-15
Day31-35/res/vim-diff.png
Day31-35/res/vim-diff.png
+0
-0
Day31-35/玩转Linux操作系统.md
Day31-35/玩转Linux操作系统.md
+70
-15
未找到文件。
Day31-35/res/vim-diff.png
0 → 100644
浏览文件 @
a748707c
78.5 KB
Day31-35/玩转Linux操作系统.md
浏览文件 @
a748707c
...
...
@@ -413,27 +413,27 @@ Linux系统的命令通常都是如下所示的格式:
```
Shell
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cat
1
.txt
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cat
foo
.txt
grape
apple
pitaya
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cat
2
.txt
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cat
bar
.txt
100
200
300
400
[root@iZwz97tbgo9lkabnat2lo8Z ~]# paste
1.txt 2
.txt
[root@iZwz97tbgo9lkabnat2lo8Z ~]# paste
foo.txt bar
.txt
grape 100
apple 200
pitaya 300
400
[root@iZwz97tbgo9lkabnat2lo8Z ~]# paste
1.txt 2.txt > 3
.txt
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cut -b 4-8
3
.txt
[root@iZwz97tbgo9lkabnat2lo8Z ~]# paste
foo.txt bar.txt > hello
.txt
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cut -b 4-8
hello
.txt
pe 10
le 20
aya 3
0
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cat
3
.txt | tr '\t' ','
[root@iZwz97tbgo9lkabnat2lo8Z ~]# cat
hello
.txt | tr '\t' ','
grape,100
apple,200
pitaya,300
...
...
@@ -662,16 +662,16 @@ Linux系统的命令通常都是如下所示的格式:
### 编辑器vim
1. 启动vim。
1. 启动vim。
可以通过`
vi
`或`
vim
`命令来启动vim,启动时可以指定文件名来打开一个文件,如果没有指定文件名,也可以在保存的时候指定文件名。
```Shell
[root@iZwz97tbgo9lkabnat2lo8Z ~]# vim guess.py
```
2. 命令模式、编辑模式和末行模式:启动vim进入的是命令模式
,在命令模式下输入英文字母`
i
`会进入编辑模式,屏幕下方出现`
-- INSERT --
`提示;在编辑模式下按下`
Esc
`会回到命令模式,此时如果输入英文`
:
`会进入末行模式,在末行模式下输入`
q!
`可以在不保存当前工作的情况下强行退出vim,如果希望执行保存退出,则应该在末行模式下输入`
wq
`
。
2. 命令模式、编辑模式和末行模式:启动vim进入的是命令模式
(也称为Normal模式),在命令模式下输入英文字母`
i
`会进入编辑模式(Insert模式),屏幕下方出现`
-- INSERT --
`提示;在编辑模式下按下`
Esc
`会回到命令模式,此时如果输入英文`
:
`会进入末行模式,在末行模式下输入`
q!
`可以在不保存当前工作的情况下强行退出vim;在命令模式下输入`
v
`会进入可视模式(Visual模式),可以用光标选择一个区域再完成对应的操作
。
3.
退出vim:在命令模式下输入`
:
` 进入末行模式,输入wq可以实现保存退出;如果想放弃编辑的内容输入`
q!
`强行退出,这一点刚才已经提到过了;在命令模式下也可以直接输入`
ZZ
`实现保存退出
。
3.
保存和退出vim:在命令模式下输入`
:
` 进入末行模式,输入`
wq
`可以实现保存退出;如果想放弃编辑的内容输入`
q!
`强行退出,这一点刚才已经提到过了;在命令模式下也可以直接输入`
ZZ
`实现保存退出。如果只想保存文件不退出,那么可以在末行模式下输入`
w
`;可以在`
w
`后面输入空格再指定要保存的文件名
。
4. 光标操作。
...
...
@@ -715,17 +715,18 @@ Linux系统的命令通常都是如下所示的格式:
```Shell
[root@iZwz97tbgo9lkabnat2lo8Z ~]# vim -d
1.txt 2.txt 3
.txt
[root@iZwz97tbgo9lkabnat2lo8Z ~]# vim -d
foo.txt bar
.txt
```
![](./res/vim-diff.png)
- 打开多个文件。
```Shell
[root@iZwz97tbgo9lkabnat2lo8Z ~]# vim
1.txt 2.txt 3
.txt
[root@iZwz97tbgo9lkabnat2lo8Z ~]# vim
foo.txt bar.txt hello
.txt
```
启动vim后只有一个窗口显示的是
1.txt,可以在末行模式中输入`
ls
`查看到打开的三个文件,也可以在末行模式中输入`
b
<num>
`来显示另一个文件,例如可以用`
:b 2
`来显示2.txt
。
启动vim后只有一个窗口显示的是
foo.txt,可以在末行模式中输入`
ls
`查看到打开的三个文件,也可以在末行模式中输入`
b
<num>
`来显示另一个文件,例如可以用`
:b 2
`将bar.txt显示出来,可以用`
:b 3
`将hello.txt显示出来
。
- 拆分和切换窗口。
...
...
@@ -742,7 +743,7 @@ Linux系统的命令通常都是如下所示的格式:
`
:inoremap __main if __name__ == '__main__':
`
> 说明:如果希望映射的快捷键每次启动vim时都能生效,需要将映射写到用户主目录下的.vimrc文件中。
> 说明:
上面例子2的`
inoremap
`中的`
i
`表示映射的键在编辑模式使用, `
nore
`表示不要递归,这一点非常重要,否则如果键对应的内容中又出现键本身,就会引发递归(相当于进入了死循环)。
如果希望映射的快捷键每次启动vim时都能生效,需要将映射写到用户主目录下的.vimrc文件中。
- 录制宏。
...
...
@@ -800,15 +801,59 @@ Dependency Installed:
nginx-mod-mail.x86_64 1:1.12.2-2.el7
nginx-mod-stream.x86_64 1:1.12.2-2.el7
Complete!
[root@iZwz97tbgo9lkabnat2lo8Z ~]# yum info nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name : nginx
Arch : x86_64
Epoch : 1
Version : 1.12.2
Release : 2.el7
Size : 1.5 M
Repo : installed
From repo : epel
Summary : A high performance web server and reverse proxy server
URL : http://nginx.org/
License : BSD
Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
: IMAP protocols, with a strong focus on high concurrency, performance and low
: memory usage.
[root@iZwz97tbgo9lkabnat2lo8Z ~]# nginx -v
nginx version: nginx/1.12.2
```
下面以MySQL为例,演示如何使用rpm安装软件。
下面以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`
的依赖库。
```
Shell
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# ls
mysql-community-client-5.7.22-1.el7.x86_64.rpm
mysql-community-common-5.7.22-1.el7.x86_64.rpm
mysql-community-libs-5.7.22-1.el7.x86_64.rpm
mysql-community-server-5.7.22-1.el7.x86_64.rpm
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# yum -y remove mariadb-libs
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# yum -y install libaio
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
package mysql-community-common-5.7.22-1.el7.x86_64 is already installed
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
package mysql-community-libs-5.7.22-1.el7.x86_64 is already installed
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
package mysql-community-client-5.7.22-1.el7.x86_64 is already installed
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
package mysql-community-server-5.7.22-1.el7.x86_64 is already installed
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# mysqld --version
mysqld Ver 5.7.22 for Linux on x86_64 (MySQL Community Server (GPL))
[root@iZwz97tbgo9lkabnat2lo8Z mysql]# mysql --version
mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
```
#### 下载解压配置环境变量
...
...
@@ -858,6 +903,16 @@ git version: a20ecd3e3a174162052ff99913bc2ca9a839d618
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64
[root@iZwz97tbgo9lkabnat2lo8Z ~]# mongo --version
MongoDB shell version v3.6.5
git version: a20ecd3e3a174162052ff99913bc2ca9a839d618
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录