博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
polysh入门
阅读量:7071 次
发布时间:2019-06-28

本文共 3623 字,大约阅读时间需要 12 分钟。

hot3.png

polysh主页:

安装

安装前提python版本>2.4 安装方法:pip install polysh

使用

说明

在使用polysh连接远程shell后,

  1. 命令前面的:表示,所有的命令都是在与polysh交互,并且命令不会发送到远程shell
  2. 在命令前的!表示在本地shell中执行,不会发送到远程shell

常用方法

  1. 主机名登录:polysh 'hostname-preffix-<number01-nunmber05>'
  2. polysh帮助:连接远程主机后,输入:help
ready (15)> :help:add               添加远程连接Add one or many remote shells.:chdir             改变本地工作目录(不是远程目录)Change the current directory of polysh (not the remote shells).:disable           关闭发送命令到远程shell功能Disable sending commands to remote shells.:enable            启用发送命令到远程shell功能Enable sending commands to remote shells.:export_vars       在远程shell定义环境变量Export some environment variables on enabled remote shells.:help              帮助列表List control commands or show their documentations.:hide_password     Do not echo the next typed line.:list              列出远程shell和对应的状态List remote shells and their states.:purge             删除失效远程shell Delete disabled remote shells.:quit              登出polysh Quit polysh.:reconnect         重新连接已断开连接的远程shell Try to reconnect to disconnected remote shells.:rename            重命名Rename all enabled remote shells with the argument.:replicate         复制文件Copy a path from one remote shell to all others:reset_prompt      Change the prompt to be recognized by polysh.:send_ctrl         Send a control character to remote shells.:set_debug         Enable or disable debugging output for remote shells.:set_log           将命令窗口输出到指定本地文件Duplicate every console I/O into the given local file.:show_read_buffer  Print the data read by remote shells.:upload            Upload the specified local path to enabled remote shells.
  1. 推出polysh:连接远程主机后:quit

polysh交互命令详解

说明:一下所有都是在已进入polysh

一下所有交互注意命令前面的符号::表示与polysh交互;!表示与本地shell交互

add

例子::add hostname 将hostname shell添加到polysh批量处理的shell集合

chdir

例子::chdir testdir 将本地工作目录变更到原工作目录下的子文件夹testdir。

可以在测试前后使用!pwd查看本地工作目录,并对比。 我的在使用:chdir!pwd输出/opt/home/heguangfu/:chdir test后输出/opt/home/heguangfu/test

disable和enable

例子1::disable使所有的连接不处于激活状态,发送命令不会发送到远程shell。polysh交互提示由ready (15)>变为ready (0)>

此处使用:enable重新启用所有远程连接。

例子2::disable hostname使指定远程shell失效。

此处使用:enable hostname重新启用指定远程shell的连接。

例子3::enable worker16只启用worker16远程shell,其余的不启用。可实现对该shell单独操作

此处使用:enable重新启用所有远程连接。

list

例子::list列出所有连接和状态。

ready (14)> :listworker16 disabled idle: colors=/home/heguangfu/.dircolorsworker17 enabled  idle: colors=/home/heguangfu/.dircolorsworker18 enabled  idle: colors=/home/heguangfu/.dircolorsworker19 enabled  idle: colors=/home/heguangfu/.dircolorsworker20 enabled  idle: colors=/home/heguangfu/.dircolors

之前使用:disable的远程shell状态为disable状态(worker16),其余为enable状态。

purge

例子:purge,删除出狱disable状态的远程shell。

worker17 enabled  idle: colors=/home/heguangfu/.dircolorsworker18 enabled  idle: colors=/home/heguangfu/.dircolorsworker19 enabled  idle: colors=/home/heguangfu/.dircolorsworker20 enabled  idle: colors=/home/heguangfu/.dircolors

没有worker16的连接和状态信息了。

如果在disable后,执行purge,那么就不能使用enable回复之前的连接了。

rename

例子1::rename XXX 将所有:list可以查看到的远程shell改名为XXX(原来是个主机hostname)。 改名后第一个为XXX,第二个为XXX#1,第10个为XXX#10。。。以此类推

例子2::rename AAA XXX, 将所有shell改名为AAA XXX+编号。

使用这种方式改名不知道怎么使用改变后的shell名来执行操作。。。求有知道的大神指教!

改名后,所有polysh交互命令均需要使用改名后的名字操作,例如想将原名字为worker16,现名为XXX的shell disable,必须使用现有名去操作。

replicate

例子::replicate worker16:filename。将worker16上的文件filename发送到所有其它enable的远程shell。

:replicate只能将文件从一个远程shell发送到其余远程shell。

set_log

将命令窗口输出到指定本地文件 例子::set_log /tmp/log,将远程shell输出到本地指定文件中。

set_debug

开启和关闭远程shell的调试。

例子::set_debug y,开启调试。 调试输出:

dx:aaa#11 : /home/xxx[dbg] dx:aaa#11[running]: state => idle[dbg] dx:aaa#12[running]: ==> /home/xxx\npolysh-4wBrH:prompt:YcWrA:13/\n

例子::set_debug n, 关闭调试。

转载于:https://my.oschina.net/hgfdoing/blog/704000

你可能感兴趣的文章
ENode通信层性能测试结果
查看>>
Android应用生死轮回的那些事儿(4) - 武器库(2)-应用组件查询相关API
查看>>
IE浏览器因缓存问题未能成功向后端发送请求的几个解决办法
查看>>
八一八cvs vss svn和git比较
查看>>
iOS开发Swift篇(01) 变量&常量&元组
查看>>
有关“双重检查锁定失效”的说明
查看>>
HBase Shell输入命令无法删除问题解决技巧
查看>>
阅读天龙八部的代码有感----两种逻辑处理模式的比较
查看>>
iOS开发之新浪微博山寨版代码优化
查看>>
迥异的Linux Shell Script
查看>>
Python之环境搭建
查看>>
个人所得税计算器
查看>>
Java中使用Jedis操作Redis
查看>>
Java vararg(动态参数)的应用
查看>>
细说dex2oat(3)
查看>>
CotEditor
查看>>
SQOOP安装部署
查看>>
决策树模型组合之(在线)随机森林与GBDT
查看>>
html5实现黑客帝国数字矩阵效果
查看>>
深入浅出jcr之16 该死的RMI,我们需要HTTP+简单RPC协议
查看>>