A tmux-based SSH/Telnet Client for Managing Many-hosts
Since Mcx
is tmux
-based, you must use your system's package manager to install the tmux
first. For example, you can use
apt-get install tmux
in Ubuntu, or
brew install tmux
in Mac OS X.
The modules pexpect
, toml
and pypinyin
should be installed first via:
pip install pexpect pypinyin toml
An application that can handle the "ftp://"
urls should be installed. If you do not use ftp, this can be ignored.
git clone https://github.com/Tefx/Mcx.git
-
Copy the sample configurations to
/etc/mcx
or~/.mcx
:cp -r Mcx/conn_sample ~/.mcx
-
Change the ftp url handler by setting the value of
ftp_tool
in$CONF_PATH/config.json
.
- You can easily set it to
xdg-open
for Linux oropen
for Mac OS X. - You can alternatively set it to
filezilla
or any other specific app, as long as it can handle the urlftp://user:password@ip
.
- Put you host configurations inside
$CONF_PATH/hosts
folder.
- Have a Look at the sample host configurations. It should be self-explanatory.
conn_type
should be eitherssh
ortelnet
.auth_type
should be eitherpassword
orkey
. If the value ispassword
, the variablepassword
must be set. If the value iskey
, an optional variablepassphrase
might be needed at the same time.- The sub-folders and any number of configuration files are acceptable. The
hosts
folder will be scanned recursively for all hosts.
cd Mcx;tmux -f tmux.source
Keybinding | Description |
---|---|
Prefix S | search hosts by name. |
Prefix F | open ftp application and connect to the current host. |
Prefix V | open a vertically splited pane and connect to the same host. |
Prefix v | open a horizontally splited pane and connect to the same host. |
Prefix C | view all connected hosts. I call this listing pane as host-listing-pane . |
d | kill connections to the selected hosts. Works only in the hast-listing-pane . |
- Notes:
- The Prefix should be Ctrl-B by default in
tmux
. - Using Prefix S to connect a host which is already have connections in other window is considered as connecting a new host. The different windows connected to the same host are shown as several hosts in the
host-listing-pane
and can be killed individually. - All other tmux-shortcuts should be usable as usual.
- In searching, the patterns can be full Pinyin, Pinyin Initials, Pinyin first-letters or substrings.
/
is used for splitting different levels. For example,"北京/new/测试MySQL/Server1"
can be matched by:bj
bj/csh
bj/cs/1
new/Ser
ceshi/1
- And many other patterns. Try out by yourselves.
- The Prefix should be Ctrl-B by default in