4 Ways to Change the Time Zone on Linux

Table of contents:

4 Ways to Change the Time Zone on Linux
4 Ways to Change the Time Zone on Linux

Video: 4 Ways to Change the Time Zone on Linux

Video: 4 Ways to Change the Time Zone on Linux
Video: How to Remove a Pop Up Bathtub Drain Plug Stopper | No Screws or Tools Needed 2024, December
Anonim

This WikiHow article will guide you through changing the time zone on a Linux computer. You can change the time zone on any Linux distribution with the command line or command line options window. If you're using Mint, Ubuntu, or another distribution with a simple interface, you can change the time zone with a graphical interface.

Step

Method 1 of 4: Using the Command Line

Change the Timezone in Linux Step 1
Change the Timezone in Linux Step 1

Step 1. Open Terminal

Select the Terminal program from the list of programs, or press Ctrl+Alt+T on the keyboard.

Change the Timezone in Linux Step 16
Change the Timezone in Linux Step 16

Step 2. Check your current time zone by entering the date command into the Terminal window

After that, press Enter. The terminal will display the date in the format

Day Month Date Time Time Zone Year

  • For example, you will see output like

    Wed Mar 7 07:38:23 EDT 2017

  • . Here, "EDT" is the current time zone (Eastern Daylight Time).
Change the Timezone in Linux Step 17
Change the Timezone in Linux Step 17

Step 3. Check the available time zones

Enter the command cd /usr/share/zoneinfo and press Enter. After that, enter the command tzselect and press Enter to display a list of locations.

The /usr/share/zoneinfo directory may differ depending on the Linux distribution you are using

Change the Timezone in Linux Step 18
Change the Timezone in Linux Step 18

Step 4. Select a continent or region

Enter the number that corresponds to your general location, then press Enter.

Change the Timezone in Linux Step 19
Change the Timezone in Linux Step 19

Step 5. Select a country

Enter a number from the list provided, then press Enter.

Change the Timezone in Linux Step 20
Change the Timezone in Linux Step 20

Step 6. Select a time zone

Enter a number to select the time zone, then press Enter.

If your city is not on the list, select a city that has the same time zone

Change the Timezone in Linux Step 22
Change the Timezone in Linux Step 22

Step 7. Confirm the local time in the next command

If the time is correct, enter "1", and press Enter.

If the time is not correct, enter 2 and press Enter. Repeat the time zone selection process starting from the continent

Change the Timezone in Linux Step 21
Change the Timezone in Linux Step 21

Step 8. Make sure the time zone is set

Run the date command again, and make sure the time zone matches the selected time zone. If you see the selected time zone, you have successfully changed the time zone.

Change the Timezone in Linux Step 9
Change the Timezone in Linux Step 9

Step 9. Set the clock to always be in sync with the internet time server if desired

Most modern Linux distributions provide NTP packages by default. If the distribution you are using does not include the NTP package, you will have to install it manually. Use the following command according to your Linux distribution:

  • Ubuntu/Mint/Debian: sudo apt install ntp
  • CentOS: sudo yum install ntp

    sudo /sbin/chkconfig ntpd on

  • Fedora/RedHat: sudo yum install ntp

    sudo chkconfig ntpd on

  • Enter the command ntpdate link to server && hwclock –w after installation of the NTP package. Replace "link to server" with the address of your NTP server.

Method 2 of 4: Using the Time Zone Selection Menu

Change the Timezone in Linux Step 15
Change the Timezone in Linux Step 15

Step 1. Open Terminal

Select the Terminal program from the list of programs, or press Ctrl+Alt+T on the keyboard.

Change the Timezone in Linux Step 12
Change the Timezone in Linux Step 12

Step 2. Enter the command to change the timezone according to the distribution you are using:

  • Ubuntu and Mint - sudo dpkg-reconfigure tzdata followed by administrator or user password.
  • Redhat - redhat-config-date
  • CentOS and Fedora - system-config-date
  • ' FreeBSD and Slackware - tzselect
Change the Timezone in Linux Step 13
Change the Timezone in Linux Step 13

Step 3. Select a geographic area

Use the arrow keys to select the geographic area of your country, and then press Enter.

Change the Timezone in Linux Step 14
Change the Timezone in Linux Step 14

Step 4. Select the city or country according to your time zone, then press Enter

Your system time zone will change.

Method 3 of 4: Using the Graphical Interface on Ubuntu

Change the Timezone in Linux Step 14
Change the Timezone in Linux Step 14

Step 1. Click the system menu icon

Android7dropdown
Android7dropdown

This icon is a downward-facing triangle, and can be found in the upper-right corner of the screen. A drop-down menu will appear.

Change the Timezone in Linux Step 15
Change the Timezone in Linux Step 15

Step 2. Click the screwdriver and cog-shaped "Settings" icon in the top-left corner of the menu

The Ubuntu Control Center will open.

Change the Timezone in Linux Step 16
Change the Timezone in Linux Step 16

Step 3. Scroll down and click Details at the bottom of the left toolbar of the screen

Make sure your mouse is on the left toolbar when swiping

Change the Timezone in Linux Step 17
Change the Timezone in Linux Step 17

Step 4. Click the Date & Time tab on the left side of the window

Change the Timezone in Linux Step 18
Change the Timezone in Linux Step 18

Step 5. Disable the automatic time zone feature by clicking the "Automatic Time Zone" button in the middle of the page

If the "Automatic Time Zone" button is blue, skip this step

Change the Timezone in Linux Step 19
Change the Timezone in Linux Step 19

Step 6. Click the Time Zone button near the bottom of the window

The time zone selection menu will appear.

Change the Timezone in Linux Step 20
Change the Timezone in Linux Step 20

Step 7. Select a time zone by clicking on your location on the map

The computer time will change according to the time zone you selected.

Change the Timezone in Linux Step 21
Change the Timezone in Linux Step 21

Step 8. Close the window to save the settings and update the time zone

Method 4 of 4: Using the Graphical Interface in Mint

Change the Timezone in Linux Step 1
Change the Timezone in Linux Step 1

Step 1. Click Menu in the lower left corner of the screen

Change the Timezone in Linux Step 2
Change the Timezone in Linux Step 2

Step 2. Click the gray two screwdriver icon to open system settings

This icon is to the left of the Menu window.

Change the Timezone in Linux Step 3
Change the Timezone in Linux Step 3

Step 3. Click Date & Time in the "Preferences" group

Change the Timezone in Linux Step 4
Change the Timezone in Linux Step 4

Step 4. Click Unlock on the left side of the window

Change the Timezone in Linux Step 26
Change the Timezone in Linux Step 26

Step 5. Enter the user password if prompted

This password is used to log into the computer.

Change the Timezone in Linux Step 27
Change the Timezone in Linux Step 27

Step 6. Click the Authenticate button at the bottom of the dialog box to open the Date & Time menu

Change the Timezone in Linux Step 5
Change the Timezone in Linux Step 5

Step 7. Select a time zone

Click the vertical slice on the map to select a time zone. You will see the hour change on the right side of the page, according to the changes you made.

Change the Timezone in Linux Step 29
Change the Timezone in Linux Step 29

Step 8. Click Lock on the right side of the window

The time zone settings will be saved, and the time menu will be locked.

Tips

  • In some versions of RedHat Linux, Slackware, Gentoo, SuSE, Debian, Ubuntu, and other "normal" Linux distributions, the command to display and change the time zone is "date", not "clock".
  • On phones and other small devices running Linux, the time zone is stored differently. The timezone file is stored in /etc/TZ, in the format described at [https://docs.sun.com/source/816-5523-10/appf.htm. Edit the file manually or use the "echo" command (eg echo GMT0BST > /etc/TZ to change the timezone to UK).

Warning

  • Some applications, such as PHP, have their own time zone that is different from the system time zone.
  • On some systems, you can use a system program that will request the correct time zone and change the time zone according to your changes. For example, Debian provides the program "tzsetup" or "tzconfig."

Recommended: