Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Does anyone know of a way to determine the current X resolution from the command line, without using randr?

share|improve this question
up vote 7 down vote accepted

you can grep output of xdpyinfo or xwininfo -root or xprop -root.

share|improve this answer
Perfect, thanks! I wound up using "xdpyinfo | grep dimensions" – Brad Aug 24 '11 at 21:24

I'm not sure if xdpyinfo uses RANDR:

xdpyinfo | grep dimensions:

This one assumes the root window's size is the resolution:

xwininfo -root |egrep 'Width:|Height:'
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.