How to set primary monitor and relation between monitors on ubuntu using terminal?

Solution 1:

I figured it out. The command line tool is xrandr. The first step is to print all screens in the system by executing command:

xrandr

Next, when we know what the names are, we can adjust settings, in my case it was something like that:

xrandr --output DVI-I-1 --primary --right-of VGA-1

It set DVI-I-1 as primary monitor and 'moved' it on the right side of VGA-1 monitor.