Advertisement
Guest User

How to set timezone in linux... really... this method works!

a guest
Oct 2nd, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.65 KB | None | 0 0
  1. #How to set timezone in linux... really... this method works!
  2. #/KNOPPIX/knoppix.sh
  3.  
  4. #set "localtime" timezone
  5. #remove original "timezone link"
  6. rm -f /etc/localtime
  7. #create link from your preferred timezone file to "timezone link" example:
  8. ln -s /usr/share/zoneinfo/Europe/Budapest /etc/localtime
  9.  
  10. # setup for EDT and EST (+4 EDT; +5 EST)
  11. #ln -s /usr/share/zoneinfo/EST5EDT /etc/localtime
  12.  
  13. # setup for only EST (+5 EST)
  14. #ln -s /usr/share/zoneinfo/EST /etc/localtime
  15.  
  16. # setup for only Daylight Saving Time
  17. #ln -s /usr/share/zoneinfo/EDT /etc/localtime
  18.  
  19. #...
  20.  
  21. #here is how to set "timezone environment variable" in a terminal to GMT for example
  22. # (console GMT, x budapest time)
  23. #echo '"TZ=GMT"; export TZ;' > /home/knoppix/.profile
  24. #echo '"TZ=GMT"; export TZ;' > /root/.profile
  25.  
  26. #setting "systemwide timezone" (budapest time, hwclock GMT) (this sets the time in xorg too if you do this before starting x server!)
  27. rm /etc/timezone
  28.  
  29. echo "Europe/Budapest" > /etc/timezone
  30. export TZ="/usr/share/zoneinfo/Europe/Budapest"
  31.  
  32. # setup local timezone "US/Eastern" - "America/New_York"
  33. echo "US/Eastern" > /etc/timezone
  34. export TZ="/usr/share/zoneinfo/America/New_York"
  35.  
  36.  
  37. #now set your hardware clock preferably to GMT time...
  38. #set gmt time and date with example:
  39. #date -u --set "2014-08-24 03:18:00+00"
  40. #Sun Aug 24 03:18:00 UTC 2014
  41.  
  42. #show local time
  43. #root@Microknoppix:/media/sda2/KNOPPIX# date
  44. #Sun Aug 24 05:19:50 CEST 2014
  45. #show gmt time
  46. #root@Microknoppix:/media/sda2/KNOPPIX# date -u
  47. #Sun Aug 24 03:19:53 UTC 2014
  48.  
  49. #you can use the tzselect tool for selection of timezone in a script
  50. #tzselect
  51.  
  52. #synchronize hw clock
  53. #hwclock --hctosys
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement