I log into a linux server, which is in an European time zone. How to make my account in an Asian time zone? And I don't have the super user permission.
The systems are centos 6.5 and ubuntu 12.10, two servers.
I log into a linux server, which is in an European time zone. How to make my account in an Asian time zone? And I don't have the super user permission.
The systems are centos 6.5 and ubuntu 12.10, two servers.
if you have read permissions to /usr/share/zoneinfo/
and its children (which you would normally), you can set the timezone in your ~/.bashrc
or ~/.bash_profile
, by executing this command:
export TZ="/usr/share/zoneinfo/{TIMEZONE-DIRECTORY}/{TIMEZONE_FILE}"
with the correct Timezone dir and Timezone file within /usr/share/zoneinfo/.
http://www.cyberciti.biz/faq/howto-linux-set-time-zone-per-user-basis/
TZ
as Asia/Shanghai
, and then call date
, it gives me another wrong time. The real time is 13:22, but it shows 21:27.(before the setting, it shows 08:27)
export -p
to confirm that the TZ variable has been correctly set, and everything is spelled correctly. the server clock may be off. use date -u
to check the UTC time, and verify it against worldtimeserver.com/current_time_in_UTC.aspx
Dec 25, 2014 at 6:45
date -u
gives me right time, but date
still not. does that mean the server clock is off? how to make it on?
You can change the time zone by executing the below command.
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/xxxx /etc/localtime
Replace Asia/xxxx according to your time zone.