How to Set the Time Zone Using the Linux Terminal

If you happen to’ve moved or are touring together with your Linux laptop computer, it’s possible you’ll be questioning easy methods to change your system’s time zone. It is simple to set your Linux laptop’s time zone from the command line. Here is easy methods to do it.

Viewing Time Zones With tzselect

tzselect continent selection

On Linux methods, time zones are outlined by the Time Zone Database, also called tzdata, managed by the Web Assigned Numbers Authority.

As time zones can change politically, it is useful to have them managed in a central database that different methods can use. Tom Scott explains why that is such a good suggestion:

To view the names of the time zones within the database on your location, you should use the tzselect command. It is a menu-driven program that may slim down the title of the time zone you need.

You begin with the tzselect command on the shell:


It will convey up a menu of continents, and you may drill down by to your nation’s and your native space’s time zone, if relevant.

For instance, the Pacific Time Zone is represented as “America/Los_Angeles.” tzselect will ask to substantiate whether or not that is right. After that, it is going to let you know easy methods to make the change everlasting utilizing the $TZ surroundings variable.

Setting Time Zones With the $TZ Atmosphere Variable

TZ environemntal variable on the linux command line

You’ll be able to merely set the time zone with the $TZ surroundings variable. For instance, to set it to the Pacific Time Zone:

export TZ="America/Los_Angeles"

To make this transformation everlasting, you possibly can put this line in your shell configuration information like .bashrc or .zshrc.

Associated: What Are Atmosphere Variables in Linux? All the pieces You Must Know

Setting Time Zones With /and many others/timezone and /and many others/localtime

/etc/localtime symbolic link

If you wish to make system-wide adjustments to the time zone, reminiscent of for a desktop system or a laptop computer that stays in a single location, you should use the /and many others/timezone and /and many others/localtime information. Which file you will use relies on which system you are working.

Debian and Ubuntu methods use the previous. These information are normally set at set up, however you possibly can change them afterward. To search out out which information you utilize in your system, seek the advice of your distribution’s documentation.

To vary the time zone utilizing /and many others/timezone, you’d edit it with any textual content editor and place the time zone title you bought earlier in that file. You may want to make use of sudo as a result of the foundation person owns the file.

For instance, to edit it with vim:

sudo vim /and many others/timezone

With /and many others/localtime, you modify the time zone by making a symbolic hyperlink to a binary file that has the identical title because the time zone within the /usr/share/zoneinfo listing.

If you happen to wished to set your machine to Pacific time utilizing /and many others/localtime, you’d use the ln command with the -s choice to create a symbolic hyperlink and -f to overwrite it if it already exists:

sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /and many others/localtime

Now You Can Set the Time Zone From the Command Line

Regardless of the place your travels take you, you possibly can at all times ensure you’re preserving the fitting time with a number of easy instructions. If you happen to’re seeking to convert time zones within the browser, learn on for extra on easy methods to use a web-based instrument, MyTimeZone, to take action.

The way to Immediately Convert Time Zones With One Click on

Do you at all times have hassle changing your time zone into one other? This nifty extension makes it foolproof and simple.

Learn Subsequent

About The Creator

Leave a Comment