You want to query the current resolution of a screen connected as framebuffer device (e.g.
/sys virtual filesystem contains all information about a framebuffer device in
In order to get the size, use
fb0 with the name of the framebuffer device to query.
This will print a line like
In order to get the width/height as number, you can use this command:
cat /sys/class/graphics/fb0/virtual_size | cut -d, -f1 # Get width cat /sys/class/graphics/fb0/virtual_size | cut -d, -f2 # Get height