GNOME GUI Customizations through the Ubuntu Command Line

As a Linux user, especially an administrator, you might be very well aware of the power of the command line. There is always a way to do almost all of our stuff right inside the Terminal. Using the Terminal makes certain tasks more efficient, and even faster. The command-line tools do not use too many resources and thus form great alternatives to the widely used graphical applications, especially if you are stuck up with older hardware.

This article is specially designed for Ubuntu administrators, the remote ones, in particular, so that they can make customizations to some UI related functions through the Terminal. These include:

  • Controlling the Screen brightness
  • Activating night light
  • Changing the Text size
  • Changing the Timezone

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.

Controlling the Screen Brightness

Controlling the brightness of your screen through the command line includes retrieving the name of your monitor and then setting the brightness level, both through the Xrandr utility.

Open the Terminal application either by using the Ctrl+Alt+T shortcut or by accessing it through the application launcher search as follows:

Open Ubuntu Terminal

Step 1: Fetch the Monitor’s name

In this step, we will fetch the name of the monitor currently connected to your Ubuntu system through the Xrandr tool. The Xrandr tool (an app component in Xorg) is a command line interface to RandR extension and can be used to set outputs for a screen dynamically, without any specific setting in xorg.conf. This utility is installed, by default, on a Ubuntu 18.04 system.

Run the following command in your Terminal to fetch your monitor’s name:

$ xrandr | grep " connected" | cut -f1 -d " "

Get name of the current monitor

I am using an LCD laptop and the output suggests the name of my monitor as LVDS-1

Step 2: Change the brightness level

Now that you know your monitor’s name, you can set the new brightness-level through the following command syntax:

$ xrandr --output [monitor-name] --brightness [brightness-level]

The brightness level should be set between 0.5 to 1 for better visibility.

I used the following command to set my brightness level to 0.75 which is about right for using the laptop at night.

$ xrandr --output LVDS-1 --brightness 0.75

Change screen brightness

Through this simple tool, that comes already installed in your Ubuntu, you can adjust the brightness of your screen right from your command line.

Activating Night Light

Your screen light is typically set to a blue shade for better viewing. However, at night time this blue light puts some extra strain on our eyes; so a better option is to switch to a warmer light by activation of the Night Light feature.

For a Terminal-savvy person who likes using the command line for most operations, we have two solutions to activate Night Light here. You can use one of the following two commands from your Terminal and the night light will be activated right then:

Option 1:

$ gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true

Or,

Option 2:

$ dconf write /org/gnome/settings-daemon/plugins/color/night-light-enabled true

When you use one of these commands to enable night light, it will be automatically scheduled to be activated according to the sunrise and sunset timings fetched from the Internet.

In order to turn off night light, you can use one of the following two commands:

Option 1:

$ gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false

Or,

Option 2:

$ dconf write /org/gnome/settings-daemon/plugins/color/night-light-enabled false

Change the Text size

While using a Ubuntu system if you encounter difficulty in reading the text on your screen, there are many ways you can fix it according to your vision requirements. Here is the command line based approach to do so:

Open the Terminal application and use the following command syntax in order to change the text size:

$ gsettings set org.gnome.desktop.interface text-scaling-factor [scaling-factor-value]

For example,

$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.6

Change Desktop text size trough command-line

To reset the scaling factor back to the default value (1.00), you can use the following command:

$ gsettings reset org.gnome.desktop.interface text-scaling-factor

change text size using gsettings

Now you can set the font/text size of your Ubuntu screen right according to your needs!

Changing the Timezone

Step 1: Check the Current Time Zone

Open your Terminal application and then enter the following command in order to view information about your system time and time zone:

$ timedatectl

Using timedatectl

You can also view this information by using the following command:

$ ls -l /etc/localtime

Get localtime setting

Step 2: Change the Time Zone

Enter the following command in order to list timezones of the specified zone:

Syntax:

$ timedatectl list-timezones | grep -i [zone]

Example:

We will use this command to list all the time zones of Europe:

$ timedatectl list-timezones | grep -i europe

Get list of timezones

In this example, we will be setting the time zone to Europe/Istanbul. First, let us unlink the system time with local time through the following command:

$ sudo unlink /etc/localtime

The next step is to use the following command to set a new time zone:

Syntax:

$ sudo ln -s /usr/share/zoneinfo/[Zone/TimeZone] /etc/localtime

Example:

$ sudo ln -s /usr/share/zoneinfo/Europe/Istanbul /etc/localtime

You can verify the changed settings through one of the following commands:

Change timezone on Ubuntu

$ timedatectl

or

$ ls -l /etc/localtime

You can now easily claim to have power over the Ubuntu UI through its command line.