Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to change the resolution / geometry of my VNC session dynamically without affecting the programs running inside it.

I referred: Changing the resolution of a VNC session in linux. I don't have root permission to update the newer vncserver version, so following command doesn't work as of now:

vncserver -geometry 1280x1024 -randr 1280x1024,1280x800

For now, whenever I want to change the screen size from one monitor to other, I kill the session and restart it with modified -geometry option. Due to this I have to loose the programs inside it.

Is there any way to hack the file which stores the geometry and change the values for changing the resolution? I couldn't find such file. In my home folder, I see below files:

mgandhi@starbase:~/.vnc$ ll
total 12
-rwxr-xr-x 1 mgandhi bc  334 Jun 25 10:32 xstartup
-rw------- 1 mgandhi bc    8 Jun 25 10:32 passwd
-rw-r--r-- 1 mgandhi bc    6 Jun 25 11:08 starbase.radisys.com:23.pid
-rw-r--r-- 1 mgandhi bc 1664 Jun 25 11:08 starbase.radisys.com:23.log

The contents of xstartup file doesn't help:


# Uncomment the following two lines for normal desktop:
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

... here xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & line remains constant for any resolution.

[Note: I see that xrandr is installed in the linux machine.]

share|improve this question

migrated from stackoverflow.com Jun 25 '12 at 12:37

This question came from our site for professional and enthusiast programmers.

A "Hack" solution: start the vncserver without any specified geometry

vncserver :1

Then I'll connect to the vnc, and in Fedora, I'll just go into Settings>Displays>Unknown 0" and change the resolution on the fly like this. Take some clicking rather than typing (DX), but its easy.

share|improve this answer

$HOME/.vnc/xstartup is the file you are looking for and yes, you can set the geometry there. It should adjust on reconnect without borking your session (not 100% sure but pretty sure).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.