In this tutorial, we will guide you through the process of changing the screen resolution in Ubuntu using the command line. This is particularly useful when you are running a server version of Ubuntu which does not have a graphical interface, or if you are remotely connected to a machine and need to adjust the screen resolution.
To change the screen resolution in Ubuntu using the command line, you can use the
xrandr command. First, identify the current screen resolution and available video outputs using the
xrandr -q command. Then, use the
xrandr --output <OUTPUT> --mode <RESOLUTION> command to change the screen resolution. If the desired resolution is not available, you can create a new one using the
cvt command and add it using the
xrandr command. To make the resolution change permanent, add the commands to the
.xprofile file in your home directory.
Understanding the Command Line
The command line, or terminal, is a powerful tool that allows you to control your system directly. It can be accessed in Ubuntu by pressing
Ctrl+Alt+T. In this tutorial, we will be using two specific commands:
xrandr: This command is used to set the size, orientation, and/or reflection of the outputs for a screen.
cvt: This command generates a modeline, which is a configuration line that instructs your system how to drive the monitor at a specific resolution.
Identifying Current Screen Resolution and Outputs
Before changing the screen resolution, you need to identify the current screen resolution and the available video outputs. To do this, open a terminal and run the following command:
This command will display a list of all the available video outputs and their current resolutions. Note the name of the output you want to change the resolution for.
Changing the Screen Resolution
To change the screen resolution, you can run the following command:
xrandr --output <OUTPUT> --mode <RESOLUTION>
<OUTPUT> with the name of the output you want to change (for example, “VGA1”) and
<RESOLUTION> with the desired resolution (for example, “1920×1080”).
Creating a New Resolution
If the desired resolution is not available, you can create a new one using the
cvt command. Here are the steps:
- Run the
cvtcommand with the desired width, height, and refresh rate as parameters:
cvt <WIDTH> <HEIGHT> <REFRESH_RATE>
For example, if you want a resolution of 1600×900 with a refresh rate of 75Hz, you would run
cvt 1600 900 75.
- Copy the output of the
cvtcommand that starts with “Modeline”.
- Add the new mode to the list of available modes with the
xrandr --newmode "<MODELINE>"
<MODELINE> with the copied output from the
- Add the new mode to the desired output:
xrandr --addmode <OUTPUT> <MODE>
<OUTPUT> with the name of the output and
<MODE> with the name of the mode (the first part of the modeline).
- Set the new resolution:
xrandr --output <OUTPUT> --mode <MODE>
Making the Resolution Change Permanent
To make the resolution change permanent, you can add the commands to the
.xprofile file in your home directory. Here’s how:
- Open the
.xprofilefile with a text editor:
- Add the commands from steps 3 to 5 in the “Creating a New Resolution” section, each on a new line.
- Save the file and exit the text editor.
Now, the new resolution will be set every time you log in.
Changing the screen resolution in Ubuntu using the command line may seem complex, but it offers a high level of control over your system. Whether you are running a server version of Ubuntu, remotely connected to a machine, or simply prefer using the command line, this guide should help you adjust the screen resolution to your needs.
Yes, you can change the screen resolution in Ubuntu using the graphical interface. To do this, go to the "Settings" menu, select "Displays," and then adjust the resolution using the provided options.
To revert back to the original screen resolution, you can run the
xrandr command with the
--auto option. This will automatically set the screen resolution to the default value.
Yes, you can change the screen resolution for multiple monitors by specifying the output name for each monitor in the
xrandr command. For example,
xrandr --output HDMI1 --mode 1920x1080 --output VGA1 --mode 1280x1024 will set the resolution for both the HDMI1 and VGA1 outputs.
You can check if your new screen resolution is supported by your monitor by running the
cvt command with the desired resolution parameters. If the command outputs a modeline, it means that the resolution is supported. However, it is always recommended to consult your monitor’s specifications or manual for the supported resolutions.
Changing the screen resolution should not significantly affect the performance of your system. However, using a higher resolution may require more system resources, such as GPU power and memory. If you notice any performance issues after changing the screen resolution, you can try reducing the resolution or adjusting other graphical settings to improve performance.
Yes, you can set a custom refresh rate for your screen using the
xrandr command. When creating a new resolution with the
cvt command, you can specify the desired refresh rate as a parameter. For example,
cvt 1920 1080 75 will generate a modeline with a refresh rate of 75Hz. You can then add and set this new mode using the
xrandr command as described in the tutorial.