目录
一、Linux常用命令
1)# 与 $ 提示的区别
2)ifconfig
3) su
su 用户名
4) cd
5) 目录查看
6) 查看文件内容
7)创建目录及文件
8)复制和移动
9)其他
10) tar
11) which
12) whereis
13) find
14) chmod
二、vim一般使用
| 符号 | 意义 | 
|---|---|
| i | 进入编辑模式,vim打开文件后,默认在命令模式,点击i键方可进入编辑模式 | 
| esc | 退出编辑模式,进入命令模式 | 
| :w | 写入 | 
| :q | 退出,如果修改了内容则这种不能退出,如果需要强制退出则使用q! | 
| :wq | 写入并退出 | 
| :q! | 强制退出,不写入 | 
| dd | 删除当前行(编辑模式下) | 
| ndd | 删除n行(编辑模式下) | 
| /string | 搜索字符串(编辑模式下), 按n查找下一个,N上一个,/str$表示匹配行尾的str, 在查找模式中加入\c表示大小写不敏感查找,\C表示大小写敏感查找,例如:/foo\c将会查找所有的"foo","FOO","Foo"等字符串 | 
| :s | (substitute)命令用来查找和替换字符串,语法::{作用范围}s/{目标}/{替换}/{替换标志}; 例如:%s/foo/bar/g会在全局范围(%)查找foo并替换为bar,所有出现都会被替换(g),:s/foo/bar/g 替换当前行,:%s /foo/bar /g 全局替换 | 
| :%d | %是匹配所有行,d是删除的意思, 该命令将清空打开的文件的内容 | 
| :$ | 跳到文件尾部 | 
| :n | 跳到n行 | 
| u | 撤销上一步的操作 | 
| Ctrl+r | 恢复上一步被撤销的操作 | 
三、SSH介绍
1) 什么是SSH
2)SSH服务端和客户端
3)基本工作机制
四、SSH密钥登录
1) 首先在服务器中创建密钥对
[root@localhost .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:+LTzDddLCyrFVb9bHRMnOssHgOGJbffji/NV5/hPAEA root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|        .+E      |
|       +....  o..|
|      . = ...o oo|
|       o . .=. o.|
|      . S. oo+. B|
|       o .o.oo.*+|
|        +.. +.= =|
|        .o.* = * |
|         .+o+ o +|
+----[SHA256]-----+
2)在服务器中安装公钥
[root@localhost .ssh]# cat id_rsa.pub >> authorized_keys
[root@localhost .ssh]# ls
authorized_keys  id_rsa  id_rsa.pub
3) 设置文件权限
[root@localhost .ssh]# chmod 600 authorized_keys
[root@localhost .ssh]# chmod 700 ~/.ssh
[root@localhost .ssh]# vim /etc/ssh/sshd_config
# 加密算法
RSAAuthentication yes
# 使用密钥进行认证
PubkeyAuthentication yes
5)重启ssh服务
[root@localhost .ssh]# systemctl restart sshd
xshell配置如下:

bitvise配置:

点击出现如下图:

 










