gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize 3
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ vsize 2

Source :
http://askubuntu.com/questions/447673/how-to-change-number-of-workspaces-from-command-line