How to Set the Timezone in Linux

Though the graphical desktop environments for all modern Linux distributions include some utility with which to set the date, time, and timezone of the system, it's also possible to set the timezone via the command line using a few simple commands. The benefit to doing it this way is that the same commands will work across most Linux distributions. In most cases, the graphical utilities that the desktop environments use are simply wrappers for the shell commands that are typed into the terminal anyway.

Instructions

    • 1

      Open a terminal window and log in as root, or use the "sudo command" to gain temporary root privileges. You need to have access to the system configuration in order to run these commands.

    • 2

      Run the date command. Running date with no parameters simply displays the current date and time, including the timezone. In this example, EDT is the timezone, corresponding to Eastern Time in the USA.

    • 3

      Move to the appropriate subdirectory in the /usr/share/zoneinfo directory using the "cd command." This directory contains all of the information about all of the time zones in the world, organized by region.

    • 4

      Create a backup of the current timezone configuration. It is always a good idea to save previous settings before changing something systemwide. Use the mv command to copy the current timezone configuration file to a new file.

    • 5

      Link the correct timezone to /etc/timezone using the ln command. Using the "ln command" with the -s option creates a symbolic link, which means that a reference to another file is created, not a copy of the file.

    • 6

      Update the current system time by synchronizing with an Internet time server. Use the"rdate utility" to do this.

    • 7

      Edit the /etc/sysconfig/clock file using a text editor. Set the entry called ZONE to the correct timezone.

    • 8

      Set the clock on the computer's motherboard to the system time using the "hwclock utility." This synchronizes the time stored in the CMOS chip to the time that the operating system has.

Tips & Warnings

  • If you use GNOME, KDE, or any other desktop environment, read the documentation to find out how to set the timezone using an included utility or applet.

Related Searches:

Comments

You May Also Like

Related Ads

Featured