Table of Content

MobaXterm is all-in-one multi-tab tool for ssh/sftp/local terminal/X server, here is discussion how to integrate it to portabledevops.

Most used feature from mobaxterm

  • local terminal, behind is cygwin subsystem
  • ssh client, it can import session from SecureCRT, putty
  • macro, one key to automate repeated tasks

basic setup

By default there is portable version ready there: download

You just place it to one folder, launch it, you can run it without anything change, then you will find cygwin root and home created in somewhere randomly, this is not what we want.

in Setting/General, you can setup persistent root and home.

Persistent root(/) directory:  best choice is to create root folder under , it will become 
_CurrentDrive_:\\root\slash

Persistent home directory: 
there are two good choices, one of C:\Users\ ; another is to create home folder under , it will become 
_CurrentDrive_:\\home

integrate to portabledevops

mobaxterm used cygwin but with some customization, since home folder could be in different location, so uses $SYMLINKS to identity portable folder.

if [  $(env|grep MOBANOACL) ]; then
	export PORTFOLDER=$(echo $SYMLINKS|rev|cut -d'/' -f5-|rev|cut -d: -f2-)
	export HOMEDRIVEL=$(echo $SYMLINKS|cut -d: -f1)
fi

You just need to download portabledevops.sh and place to /root/slash/etc/profile.d/, then it is ready to get benefits from portabledevops.

For example alias for shortcut:

alias|grep cygdrive
alias 7zp='/cygdrive/C/oldhorse/portableapps/7z/7-ZipPortable.exe'
alias bk='/cygdrive/C/oldhorse/portableapps/brackets/BracketsPortable.exe'
alias calibrep='/cygdrive/C/oldhorse/portableapps/calibre/calibre-portable.exe'
alias cmdermini='/cygdrive/C/oldhorse/portableapps/cmdermini/cmder.exe'
alias console='/cygdrive/C/oldhorse/portableapps/console2/Console.exe'
alias dc='/cygdrive/C/oldhorse/portableapps/dockertoolbox/docker-compose.exe'
alias dm='/cygdrive/C/oldhorse/portableapps/dockertoolbox/docker-machine.exe'
alias fc='/cygdrive/C/oldhorse/portableapps/freecommander/FreeCommanderPortable.exe'
alias fzp='/cygdrive/C/oldhorse/portableapps/filezilla/FileZillaPortable.exe'
alias gshot='/cygdrive/C/oldhorse/portableapps/greenshot/Greenshot.exe'
alias img='/cygdrive/C/oldhorse/portableapps/imgburn/ImgBurn.exe'
alias kitty='/cygdrive/C/oldhorse/portableapps/kitty/kitty_portable.exe'
alias lua='/cygdrive/C/oldhorse/portableapps/Lua/5.1/lua.exe'
alias mp='/cygdrive/C/oldhorse/portableapps/markdownpad2/MarkdownPad2.exe'
alias qdir='/cygdrive/C/oldhorse/portableapps/qdir/Q-Dir.exe'
alias scite='/cygdrive/C/oldhorse/portableapps/scite/SciTE.exe'
alias st3='/cygdrive/C/oldhorse/portableapps/sublimetext3/sublime_text.exe'

git

You can install git using apt-cyg, or just uses Git for Windows.

which -a git
/drives/c/Program Files/Git/cmd/git

You may get this error:

git log
/bin/busybox.exe less -R: /bin/busybox.exe: No such file or directory

It caused by less command which in fact linked to busybox.exe in mobaxterm cygwin subsystem.

Here is easy remedy without install extra:

git log|cat|more
commit 0224a36fdaf149e0399b2b26e3f6d6b98e3d1a50
Author: robertluwang 
Date:   Sun Oct 8 08:11:49 2017 -0400
    update README

docker toolbox

docker-machine start moba
Starting "moba"...
(moba) Check network to re-create if needed...

docker-machine status moba
Running

docker-machine ssh moba
fork/exec C:\oldhorse\PORTAB~1\MOBAXM~1\root\slash\bin\ssh.exe: This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

this is strange issue, ssh not working properly with docker-machine, there are two options:
1) docker-machine –native-ssh ssh moba
it will use Go buildin ssh client, I add it as alias to portabledevops,

alias nassh='dm --native-ssh ssh'

nassh moba 
nassh moba docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

2) create own function dmssh to do "docker-machine ssh" using ssh directly access to docker vm

dmssh moba
dmssh moba docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

this is very useful when "docker-machine env" and docker not working on windows when network environment changed. There are tons of remedy for each docker-machine release but not one is stable, my solution works stable not only for mobaxterm but also msys and Cygwin.