Software & AppsOperating SystemLinux

How To Change Screen Resolution in Ubuntu Command Line

Ubuntu 10

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.

Quick Answer

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 and cvt.

  • 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:

xrandr -q

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>

Replace <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:

  1. Run the cvt command 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.

  1. Copy the output of the cvt command that starts with “Modeline”.
  2. Add the new mode to the list of available modes with the xrandr command:
xrandr --newmode "<MODELINE>"

Replace <MODELINE> with the copied output from the cvt command.

  1. Add the new mode to the desired output:
xrandr --addmode <OUTPUT> <MODE>

Replace <OUTPUT> with the name of the output and <MODE> with the name of the mode (the first part of the modeline).

  1. 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:

  1. Open the .xprofile file with a text editor:
nano ~/.xprofile
  1. Add the commands from steps 3 to 5 in the “Creating a New Resolution” section, each on a new line.
  2. Save the file and exit the text editor.

Now, the new resolution will be set every time you log in.

Conclusion

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.

Can I change the screen resolution in Ubuntu without using the command line?

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.

How can I revert back to the original screen resolution?

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.

Can I change the screen resolution for multiple monitors?

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.

How can I check if my new screen resolution is supported by my monitor?

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.

Will changing the screen resolution affect the performance of my system?

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.

Can I set a custom refresh rate for my screen?

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.

Leave a Comment

Your email address will not be published. Required fields are marked *