As a Linux user, especially an administrator, you can be very knowledgeable about the power of the command line. There is always a way to do almost all of our things right in the Terminal. Using the Terminal makes certain tasks more efficient and even faster. The command line tools do not consume too many resources and, thus, form excellent alternatives to widely used graphical applications, especially if you are stuck on old hardware.
This article is specifically designed for Ubuntu administrators, in particular for remote administrators, so that they can configure some functions related to the user interface through the Terminal. This includes:
- Screen brightness control
- Night light activation
- Resize Text
- Time Zone Change
We ran the commands and procedures mentioned in this article on the Ubuntu 18.04 LTS system.
Screen brightness control
Controlling screen brightness using the command line includes getting the name of your monitor and then adjusting the brightness level using the Xrandr utility.
Open the “Terminal” application using the keyboard shortcut Ctrl + Alt + T or by accessing it through a search in the application launcher as follows:
Step 1. Get the monitor name
In this step, we will get the name of the monitor currently connected to your Ubuntu system using the Xrandr tool. The Xrandr tool (an application component in Xorg) is a command line interface for the RandR extension and can be used to dynamically set the output for the screen without any special settings in xorg.conf. This utility is installed by default on Ubuntu 18.04.
Run the following command in your terminal to get the name of your monitor:
$ xrandr | grep " connected" | cut -f1 -d " "
I am using a laptop with an LCD display and the name of my LVDS-1 monitor is displayed.
Step 2. Change the brightness level
Now that you know the name of your monitor, you can set a new brightness level using the following command syntax:
$ xrandr --output [monitor-name] --brightness [brightness-level]
The brightness level should be set in the range from 0.5 to 1 for better visibility.
I used the following command to set the brightness level to 0.75, which is suitable for using a laptop at night.
$ xrandr - LVDS-1 output - 0.75 brightness
With this simple tool that is already installed on your Ubuntu, you can adjust the screen brightness directly from the command line.
Night light activation
Your screen light is usually set to a blue tint for better viewing. However, at night this blue light creates additional tension for our eyes; so it’s better to choose a warmer light by activating the Night Light function.
For terminal-savvy people who like to use the command line for most operations, we have two solutions for activating Night Light here. You can use one of the following two commands from your terminal, and then night light will be activated at night:
$ gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
$ dconf write /org/gnome/settings-daemon/plugins/color/night-light-enabled true
When you use one of these commands to turn on night lighting, it will be automatically scheduled for activation according to the times of sunrise and sunset received from the Internet.
To turn off the night light, you can use one of the following two commands:
$ gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false
$ dconf write /org/gnome/settings-daemon/plugins/color/night-light-enabled false
When using the Ubuntu system, if you encounter difficulty reading text on the screen, there are many ways to fix this according to your vision requirements. Here is a command line based approach to do this:
Open the Terminal application and use the following command syntax to resize text:
$ gsettings set org.gnome.desktop.interface text-scaling-factor [scaling-factor-value]
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.6
To return the scale factor back to its default value (1.00), you can use the following command:
$ gsettings reset org.gnome.desktop.interface text-scaling-factor
Now you can set the font / text size on your Ubuntu screen according to your needs!
Time Zone Change
Step 1: Check Current Time Zone
Open a terminal application and then enter the following command to view information about your system time zone and time zone:
You can also view this information with the following command:
$ ls -l /etc/localtime
Step 2: Change Time Zone
Enter the following command to get a list of time zones for the specified zone:
$ timedatectl timezone list | grep -i [zone]
We will use this command to list all time zones in Europe:
$ timedatectl list-timezones | grep -i europe
In this example, we will set the time zone Europe / Istanbul. First, let’s disconnect the system time from local time using the following command:
$ sudo unlink /etc/localtime
The next step is to use the following command to set a new time zone:
$ sudo ln -s / usr / share / zoneinfo /[Zone/TimeZone] / Etc. / Localtime
$ sudo ln -s /usr/share/zoneinfo/Europe/Istanbul /etc/localtime
You can check the changed settings using one of the following commands:
$ ls -l /etc/localtime
Now you can easily claim that you can control Ubuntu through its command line.
GNOME GUI Settings via Ubuntu Command Line