Customize existing keyboard layout I need to invert the behaviour of 2 key in my keyboard ("&lt;" is inverted with "\").

I can do this easily with "Karabiner", but for me is a solution without an explanation. 

I'm linux user and usually a do this directly from "terminal".

So, if Karabiner can do the trick, I suppose that I can do it too! 

How can I modify a layout "programmatically" from terminal? Where layout configuration are stored?
I'm not sure if I got you write. I have the problem, that I want some characters on specific keys on my keyboard. I use Spark to redefine this, this works for Terminal and GUI.

http://www.macupdate.com/app/mac/14352/spark

I also tried to redefine key under MAC, but this seems to be not so easy. So if you do not want to run an extra program, I cannot recommend you a solution.