ls -lt shows time in PDT, I want to change it to
Asia/Singapore in the current session. I tried
set TZ=Asia/Singapore But it's showing the same time on
How to do it?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
To set the
TZ environment variable in
sentenv TZ Asia/Singapore
For the current shell session, use the TZ environment variable by running the command:
For this change to persist beyond this shell session, you'll need to change the file that stores the time zone. In Red Hat-based systems, that's the /etc/localtime file. You'll want to remove it and replace it with the correct timezone. Other timezones are present in the /usb/share/zoneinfo directory.
sudo rm /etc/localtime
sudo cp /usr/share/zoneinfo/Asia/Singapore /etc/localtime
date should give you the right output now.
Simple way to change timezone is to use shell variable TZ. You can do it with single line command as below :
bash -c "export TZ=Asia/Singapore"
This timezone setting will be available for current shell only from where you are exporting this TZ variable.