一、 两台服务器免密登录:

1. 生成密钥

  ssh-keygen的命令手册,通过”man ssh-keygen“命令查看指令:

  通过命令”ssh-keygen -t rsa“创建一对密匙,包括公匙和私匙,生成之后会在用户的根目录生成一个 “.ssh”的文件夹

  进入“.ssh”,查看生成的文件

 authorized_keys:存放远程免密登录的公钥,主要通过这个文件记录多台机器的公钥

  id_rsa : 生成的私钥文件

  id_rsa.pub : 生成的公钥文件

  know_hosts : 已知的主机公钥清单

    如果希望ssh公钥生效需满足至少下面两个条件:

      1) .ssh目录的权限必须是700

      2) .ssh/authorized_keys文件权限必须是600

常用以下几种方法:

    2.1 通过ssh-copy-id的方式

      命令: ssh-copy-id -i ~/.ssh/id_rsa.put <romte_ip>

      举例:

        [root@test .ssh]# ssh-copy-id -i ~/.ssh/id_rsa.pub 132.232.138.29 

        [root@test .ssh]# ssh root@ 132.232.138.29   直接连接另一台服务器就行了

    2.2 通过scp将内容写到对方的文件中

      命令:scp -p ~/.ssh/id_rsa.pub root@<remote_ip>:/root/.ssh/authorized_keys  

        scp: 即,ssh-copy-id

      举例:

          1.  scp -p ~/.ssh/id_rsa.pub root@132.232.138.29 :/root/.ssh/authorized_keys

          2.  ssh root@192.168.91.135  直接连接另一台服务器就行了

原文参考地址:http://www.cnblogs.com/LuisYang/archive/2016/10/12/5952871.html

        

ntpdate ntp1.aliyun.com   根据阿里云服务器矫正时间

  ntp:Network time Protocol,网络时间协议

# 测试sed命令
测试通过sed实现过滤匹配文本行之间的内容
匹配行后添加内容,并引用匹配模式。
##测试环境,文本内容如下:

```
[root@test sed_test]# cat test.txt1
this is a test1.
this is a test2.
this is a test3.
this is a test4.
this is a test5.
this is a test6.
[root@test sed_test]#
```

##测试p
###打印1行

```
[root@test sed_test]# sed '/test2/p' test.txt1
this is a test1.
this is a test2.
this is a test2.
this is a test3.
this is a test4.
this is a test5.
this is a test6.
[root@test sed_test]#
```

###打印多行

```
[root@test sed_test]# sed '2,3p' test.txt1
this is a test1.
this is a test2.
this is a test2.
this is a test3.
this is a test3.
this is a test4.
this is a test5.
this is a test6.
[root@test sed_test]#
```

##测试d删除
###删除单行

```
[root@test sed_test]# sed '/test2/d' test.txt1
this is a test1.
this is a test3.
this is a test4.
this is a test5.
this is a test6.
[root@test sed_test]#
```

###删除多行

```
[root@test sed_test]# sed '2,3d' test.txt1
this is a test1.
this is a test4.
this is a test5.
this is a test6.
[root@test sed_test]#

[root@test sed_test]# sed '2,4d' test.txt1
this is a test1.
this is a test5.
this is a test6.
[root@test sed_test]#
```

 

awk:

 1、求和
cat data|awk '{sum+=$1} END {print "Sum = ", sum}'

2、求平均值
cat data|awk '{sum+=$1} END {print "Average = ", sum/NR}'

3、求最大值
cat data|awk 'BEGIN {max = 0} {if ($1>max) max=$1 fi} END {print "Max=", max}'

4、求最小值(min的初始值设置一个超大数即可)
cat data | awk 'BEGIN {min = 1999999} {if ($1<min) min=$1 fi} END {print "Min=", min}' 

 
 
 [root@dplinux-node1 sed_awk]# awk '{s[$2]++}END{for (i in s) print i,s[i]}' time.txt 
haha 100
cost 100
[root@dplinux-node1 sed_awk]#  
 
awk各种操作<===戳这里
 
 

VMWare虚拟机IP为127.0.0.1的问题

dhclient -v

 

 

.linux基础命令三的更多相关文章

  1. Linux基础命令(三)

    作业一:1) 将用户信息数据库文件和组信息数据库文件纵向合并为一个文件/1.txt(覆盖) cat /etc/passwd /etc/group >/1.txt 2) 将用户信息数据库文件和用户 ...

  2. 【Python之路】第一篇--Linux基础命令

    pwd 命令 查看”当前工作目录“的完整路径 pwd -P # 显示出实际路径,而非使用连接(link)路径:pwd显示的是连接路径 .   表示当前目录 ..  表示上级目录 /  表示根目录 ls ...

  3. Linux基础命令-文件与目录

    Linux基础命令-文件与目录 参考:<鸟哥linux私房菜>五-七章,17/12/5复习,18/01/15复习 文件权限 rwx421:用户,用户组,其他 umask查看默认权限:000 ...

  4. Linux基础命令和文件权限

    Linux命令与文件权限 Linux基础命令   reboot  重启   cd         切换目录   cd ..     回到上一级目录   cd ~      回到主目录   cd /  ...

  5. Linux基础命令-查看基本硬件信息

    Linux基础命令-查看基本硬件信息 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.查看CPU信息 [root@node101.yinzhengjie.org.cn ~]# l ...

  6. Linux基础命令小结(超全!!)

    Linux目录结构 1.bin 存放经常使用的指令比如ll,cp 2.sbin 系统管理员使用的系统管理指令 3.home 存放普通用户的住目录 4.root 系统管理员的用户主目录 5.boot 存 ...

  7. Linux 基础命令及基本目录

    Linux 基础命令及基本目录 一.网卡 1.网卡配置文件路径 ​ /etc/sysconfig/network-scripts/ifcfg-eth0 配置文件: TYPE=Ethernet # 以太 ...

  8. Linux——基础命令用法(上)

    一.Linux基础命令 1.Linux命令行的格式 命令行的格式为:用户名+主机名+当前工作目录 输入内容的命令格式为:命令 [-短选项/--长选项] [参数] [root@localhost ~]# ...

  9. day04 Linux基础命令

    day04 Linux基础命令 查看帮助信息命令 1.man命令:man命令的功能是查看指定命令的详细解释. 格式:man [具体需要被查看的命令] [root@localhost ~]# man r ...

随机推荐

  1. 表格 td 设置宽度无效问题

    现在有个需求,就是表格的列不固定,都是动态加载的,想给每一列设置宽度,但是设置 width:100xp,没有效果,不过设置min-width:100px 就有效果了,table的宽度为 td的宽度和 ...

  2. 【leetcode】525. Contiguous Array

    题目如下: 解题思路:这个题目可以这么做,遍历数组,如果元素是0,则count --:否则count ++:这样的话,每遍历到一个下标i,count的值就是0>i区间内0和1的差值.如果我们能找 ...

  3. java面向对象复习之一

    目的: 复习如何实现代码的逻辑思路: 复习类的封装: 复习类和对象的创建使用和封装: 练习: 实现功能:人到超市买东西 抽出三个类: 人 超市 东西: 功能点: 买: 它们之间的联系:东西包含于超市 ...

  4. Spring AOP expose-proxy

    写在前面 expose-proxy.为是否暴露当前代理对象为ThreadLocal模式. SpringAOP对于最外层的函数只拦截public方法,不拦截protected和private方法(后续讲 ...

  5. STM32内部硬核的认识

    STM32内部含有硬核,对于一些协议(例如:UART,SPI,IIC,CRC等)我们只要调用硬核就可以了,同时我们也可以自己写通信协议. 这些硬核最终肯定是要有引脚输出的,这就是为什么STM32的引脚 ...

  6. HDU-6709 Fishing Master

    Description Heard that eom is a fishing MASTER, you want to acknowledge him as your mentor. As every ...

  7. Leetcode 12. Integer to Roman(打表,水)

    12. Integer to Roman Medium Roman numerals are represented by seven different symbols: I, V, X, L, C ...

  8. Internet History, Technology, and Security(week6)——Technology: Transport Control Protocol(TCP)

    前言: 这周开始学习分层网络模型的第三层,传输层. Transport/Reliability: Transport Layer TCP层的目的是补偿IP层中可能出现的错误,并充分利用可用资源.由于I ...

  9. WEB Fuzz中需要关注的7种响应

    WEB应用模糊测试(WEB Fuzz)是一种特殊形式的网络协议模糊测试,专门关注遵循HTTP规范的网络数据包. WEB Fuzz并不是新的概念,目前有多种WEB应用模糊测试器(WEB Fuzzer), ...

  10. Visual Studio2015 community 许可证到期问题

    申请微软账户直接登录可以继续使用.