Lifewithtech

View Original

Mac Tip: Find your screen resolution, through a command line

OSX Terminal

How do you find a Screen Resolution from a Command Line in Mac OS X

Most Mac users will jump right to there Displays system preference panel to find their resolution. There’s nothing wrong with that, it’s quick and easy, and for the most part, it’s how I find it myself. However, it does require a graphical interface and because of this it’s not very helpful for scripting or remote management through SSH connections. In these cases you may want to use a command line.


You can find the screen resolution with OSX’s built in system_profiler command, which pulls the same detailed system information from the Apple System Profiler Utility but as a command line.

The system_profiler command and syntax is:

system_profiler SPDisplaysDataType | grep Resolution

Terminal output should read and should look something like the following:

 Note: I have 3 displays and shows them all

office:~ thomasfraley$ system_profiler SPDisplaysDataType | grep Resolution
          Resolution: 5120 x 2880 Retina
          Resolution: 1920 x 1200
          Resolution: 1920 x 1200
office:~ thomasfraley$