If yous've moved or are traveling with your Linux laptop, you may be wondering how to modify your system's fourth dimension zone. It's like shooting fish in a barrel to set your Linux computer's fourth dimension zone from the control line. Hither's how to do it.

Viewing Time Zones With tzselect

tzselect continent selection

On Linux systems, time zones are defined by the Time Zone Database, also known as tzdata, managed by the Net Assigned Numbers Potency.

Every bit time zones can modify politically, it'south helpful to have them managed in a central database that other systems can utilise. Tom Scott explains why this is such a practiced idea:

To view the names of the time zones in the database for your location, you lot tin can utilise the tzselect command. It's a menu-driven program that will narrow downward the proper name of the time zone you desire.

You start with the tzselect command at the shell:

          tzselect        

This volition bring up a menu of continents, and you can drill downward through to your country's and your local expanse's fourth dimension zone, if applicable.

For case, the Pacific Time Zone is represented as "America/Los_Angeles." tzselect volition ask to confirm whether this is correct. After that, information technology will tell you how to make the change permanent using the $TZ surround variable.

Setting Time Zones With the $TZ Surround Variable

TZ environemntal variable on the linux command line

Yous can merely prepare the fourth dimension zone with the $TZ surround variable. For example, to set up it to the Pacific Time Zone:

          export TZ="America/Los_Angeles"        

To make this change permanent, you tin can put this line in your shell configuration files like .bashrc or .zshrc.

Setting Time Zones With /etc/timezone and /etc/localtime

/etc/localtime symbolic link

If you want to make arrangement-broad changes to the time zone, such as for a desktop system or a laptop that stays in one location, yous can use the /etc/timezone and /etc/localtime files. Which file yous'll use depends on which system you lot're running.

Debian and Ubuntu systems utilise the onetime. These files are usually set at installation, just you tin change them afterward. To observe out which files you lot use on your organisation, consult your distribution's documentation.

To change the time zone using /etc/timezone, y'all'd edit information technology with whatever text editor and identify the time zone name you lot got earlier in that file. You'll need to use sudo because the root user owns the file.

For example, to edit it with vim:

          sudo vim /etc/timezone        

With /etc/localtime, you change the fourth dimension zone past creating a symbolic link to a binary file that has the aforementioned name as the time zone in the /usr/share/zoneinfo directory.

If you wanted to set your auto to Pacific fourth dimension using /etc/localtime, you'd use the ln command with the -south option to create a symbolic link and -f to overwrite it if it already exists:

          sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime        

Now Yous Tin Gear up the Time Zone From the Command Line

No matter where your travels take y'all, y'all tin can always brand sure y'all're keeping the right fourth dimension with a few simple commands. If you're looking to convert fourth dimension zones in the browser, read on for more on how to use a spider web-based tool, MyTimeZone, to practise and then.

windows-additional-time-zones-featured

How to Instantly Convert Time Zones With One Click

Read Adjacent

Nearly The Author