Right click in your Home directory and choose Create New File > Empty File.
Name it e.g. button-layout.
Open file with Scratch and paste the following lines :
#!/bin/bash
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/DecorationLayout': <'"$1"'>}"
gsettings set org.pantheon.desktop.gala.appearance button-layout "'"$1"'"
gsettings set org.gnome.desktop.wm.preferences button-layout "'"$1"'"
Close Scratch... ( file will be auto-saved ).
Right click and choose Open With > Terminal.
To change layout in : Close ( left ) and Minimize ( right ) type in Terminal :
sh ./button-layout close:minimize
To change layout in Minimize, Maximize, Close ( all right side ) :
sh ./button-layout :minimize,maximize,close
To change layout to Close ( left ) :
sh ./button-layout close:
( works in the stable version Luna as well ).