OpenBSD Set / Configure Time Zone

How do I configure or change the timezone under OpenBSD operating system?

All of the time zones OpenBSD supports are in the /usr/share/zoneinfo directory tree. You need to create a symlink to /etc/localtime file.
  1. /usr/share/zoneinfo - time zone information directory
  2. /etc/localtime - local time zone file
  3. /usr/share/zoneinfo/posixrules - used with POSIX-style TZ's (generally not required)
  4. /usr/share/zoneinfo/GMT - for UTC leap seconds

Here is my current timezone - set to Asia / Calcutta (GMT +5:30):
$ ls -l /etc/localtime
Sample output:

lrwxr-xr-x  1 root  wheel  33 Sep 19  2007 /etc/localtime -> /usr/share/zoneinfo/Asia/Calcutta

How do I change time zone?

You will see several subdirectories for various countries or continents, each containing either city names or local time zones.
# ls /usr/share/zoneinfo/
Sample output:

Africa     Atlantic   Canada     EST5EDT    Factory    GMT-0      Iceland    Japan      MST7MDT    Navajo     Portugal   UCT        WET
America    Australia  Chile      Egypt      GB         GMT0       Indian     Kwajalein  Mexico     PRC        ROC        US         Zulu
Antarctica Brazil     Cuba       Eire       GB-Eire    Greenwich  Iran       Libya      Mideast    PST8PDT    ROK        UTC        posix
Arctic     CET        EET        Etc        GMT        HST        Israel     MET        NZ         Pacific    Singapore  Universal  posixrules
Asia       CST6CDT    EST        Europe     GMT+0      Hongkong   Jamaica    MST        NZ-CHAT    Poland     Turkey     W-SU       right

Find the file for the time zone you like or for a city whose time zone you share. To set the time zone, just create a new symbolic link to the file from /etc/localtime.
# ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
Verify new timezone with the date command:
$ date
Sample outputs:

Fri Sep  2 15:32:16 CDT 2016

zic command

You can also use the zic command. Y need to give the time zone as local time. zic will act as if the input contained a link line of the form:

Link timezone       posixrules

For example set timezone to America/New_York, enteR:
# zic -l America/New_York
# date

Sample outputs:

Fri Sep  2 16:34:20 EDT 2016

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • hackbsd Nov 17, 2008 @ 1:43

    Thanks for the info, it useful for me.It is very clean and easy to understand.

  • dan Mar 23, 2009 @ 21:45

    this is absolutely wrong.
    man zic, and man localtime

  • The Doctor Jun 14, 2009 @ 9:23

    @ Dan:
    Really? Someone should contact this site to have this page updated then:

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @