xrandr -q -d :0 > xrandr.txt 2>&1
delivers in xrandr.txt: No protocol specified Can't open display :0
xrandr -q -d :0 > xrandr.txt 2>&1
delivers in xrandr.txt:
No protocol specified
Can't open display :0