0

How would I view my timezone information for my computer? Doing cat on localtime gives me compiled data or something. Here's an example:

$ cat /etc/localtime
TZif???H??????*?????ˉ??#?p?a&??t\؀????Ð????ޥ?ݩ??޾??߉????i??ip??~K??IR??
^-??)4??GJ?Q?',??3????????????????q??А????o???_???O???????/v??(??X????? ??
f??e ??H??G ??*?) ?
                                      x
                                    q(?a'?Q
?A  ?0??C?  ΐ   ?? 
?
 ௠
 #j?$5? %J?&? '*?'???) 97)6 "S?  5??4???????????ې v+ !???"V
??eGY?e턠g';?g?f?i?i?H?j???k?e l?mvG n??oV) p??q65ԐV?: X?X? Y??Z?? [޵\?? ]??
^d? _?y`Mޠa???b-??cgw?d/??EDm?E?? G-?Gӵ I
                                                  ro?s? tO?t?   ?v8??v??x??
x?͠y???z???{?f?|~??}?H?~^s??*????????????????                                                                                                                 
PDTPSTP

How would I view the contents of this file in plain text?

David542
  • 104,438
  • 178
  • 489
  • 842
  • 1
    As you pointed out, that's not a text file. It's compiled binary in [tzfile](http://man7.org/linux/man-pages/man5/tzfile.5.html) format, as produced by the [`zic`](http://man7.org/linux/man-pages/man8/zic.8.html) utility. You can use [`zdump`](http://man7.org/linux/man-pages/man8/zdump.8.html) utility to view. If you actually wanted some specific textual representation, you'll have to be more specific. What are you expecting? Also, this question is a better fit for [SuperUser](https://superuser.com/) as presently stated. – Matt Johnson-Pint Aug 25 '17 at 22:15

1 Answers1

2

Normally you just type date and will print the current time zone, for example:

Sat Aug 26 18:57:47 UTC 2017

To get only the time zone you could use:

date "+%Z" 

To get the offset:

date "+%z"

In this case time zone is set to UTC, if you would like to change the time zone you could use the command tzsetup, more info can be found here: https://www.freebsd.org/cgi/man.cgi?query=tzsetup&sektion=8, https://serverfault.com/a/56923/94862

nbari
  • 25,603
  • 10
  • 76
  • 131