Sometimes, you need to reset the display under macOS, without it being visible. Under Linux, this is incredibly easy; CTRL-ALT-F1 usually gives you a text console. You can then jump back to the GUI with alt-Left. Under macOS, this is slightly harder.
This does require preparation. First, you have to make a shortcut key to System Preferences:
- Open System Preferences
- Open the Keyboard applet
- Open the Shortcuts tab
- On the left, select App Shortcuts
- On the right, below All Applications, add a shortcut key. The text should be exactly "System Preferences..." The shortcut key could be something like Ctrl-Cmd-,
In the future, it'll help you as follows: assuming you're logged in and for some reason don't have a display, do the following procedure:
- Type Ctrl-Cmd-,
- Hit Cmd-L to assure System Preferences is at the Show All view
- Type "Displays" and hit space. This opens the Display Preferences.
- Assuming the resolution is set to "Default for display", hit the Tab key twice and press Down arrow. This selects "scaled".
- Hit tab three times. This selects the medium resolution. Hit space. This should reset the resolution and bring back your display.