Table of Content

Portable shell terminal kit consisting few parts:

1) bash shell

provided by msys, which is collection of GNU utilities on windows
/portableapps/msys

2) gcc

provided by MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.
/portableapps/mingw

3) DOS terminal replacement

default bash shell is running on DOS terminal, there are 2 type of DOS terminal replacement on widnows:

  • Console2, it received command from DOS terminal then display in *nix like terminal
  • mintty, changed from putty source without network/ssh part
    I used Console2 for long time, found mintty is more nature shell terminal if you are love of putty.
    /portableapps/Console2
    /portableapps/msys/bin/mintty

4) portable

portable key is how to detect running usb driver and mounting properly
\portableapps\msys\usbmsys-mintty.bat

@echo off

::Get the current batch file's short path
for %%x in (%0) do set BatchPath=%%~dpsx
for %%x in (%BatchPath%) do set BatchPath=%%~dpsx
::echo BatchPath = %BatchPath%

::Change to the batch file's directory
cd %BatchPath%

echo #Automatically generated - modify fstab.model > etc\fstab
::replace fstab with current directory
for /F "eol=# tokens=1,2* delims=:" %%i in (etc\fstab.model) do @echo %~d0%%j >> etc\fstab

start \portableapps\msys\bin\mintty /bin/bash -l

setup fstab file

place /etc/fstab

#Automatically generated - modify fstab.model
C:/portableapps/mingw /mingw
C:/portableapps /portable

place /etc/fstab.model
X:/portableapps/mingw /mingw
X:/portableapps /portable

double click usbmsys-mintty.bat, you get 1st mintty terminal, this is your 1st start point, all rest of portable tools you get from there.

5) setup msys profile

all portable shortcut setting is from there

  • for package, can add to PATH
    for example golang

# Golang
export GOROOT=/portable/go
export PATH=$PATH:$GOROOT/bin

  • for single portable tool, alias is good enough, for example

alias ll='ls -la'
alias more=cat

alias term='mintty /bin/bash -l'

alias py2='/portable/PortablePython2.7.5.1/App/python.exe'
alias py3='/portable/PortablePython3.2.5.1/App/python.exe'
alias ipy2='py2 -i -c "from IPython import embed;embed()"'
alias ipy3='py3 -i -c "from IPython import embed;embed()"'
alias jy='java -jar /portable/jython2.5.3/jython.jar'

alias scite='/portable/SciTEPortable/SciTE.exe'
alias kitty='/portable/Kitty/kitty_portable.exe'
alias ulipad='/portable/ulipad/UliPad.exe'
alias qdir='/portable/Q-Dir_Portable/Q-Dir.exe'
alias enote='/portable/EvernotePortable/EvernotePortable.exe'
alias lingoes='/portable/lingoes_portable/Lingoes.exe'
alias 7zp='/portable/7-ZipPortable/7-ZipPortable.exe'
alias fzp='/portable/FileZillaPortable/FileZillaPortable.exe'
alias img='/portable/ImgBurnPortable/ImgBurn.exe'
alias dvd='/portable/DVDShrinkPortable/DVDShrink3.2.exe'
alias eclipse='/portable/eclipse64/eclipse.exe'
alias console='/portable/Console2/Console.exe'
alias gshot='/portable/Greenshot/Greenshot.exe'
alias fc='/portable/FreeCommanderPortable/FreeCommanderPortable.exe'

It is easy to open more new mintty or console terminal.

$ term &
$ console &

Above setup is working for usb driver, usb hard driver or local driver, it is completely portable everywhere!