By default the OS will attempt to pick the most suitable resolution for a connected HDMI monitor. You can also select a setting yourself
Viewing Resolutions Supported By Your Monitor
tvservice -d edid
edidparser edid
Editing The Config File
sudo nano /boot/config.txt
If hdmi_mode and hdmi_group are commented out (# character at the start of the line) then the RPi will automatically select the resolution. Un-comment them and select a pair of values from http://elinux.org/RPi_config.txt which your monitor supports to use a fixed value.
Save and exit using CTRL+X, then reboot:
sudo shutdown -r now

5 years ago
You can more easily see your display modes using “tvservice -m CEA” and “tvservice -m DMT”, depending on whether you are connected to a TV (CEA) or computer monitor (DMT).
You can also reboot the pi using “sudo reboot”. Similarly, shutting it down is simply “sudo poweroff”.