9

Is there any way I can customize the timezone (which in turn would change the way the time is displayed) for a given SSH session?

The scenario: I am almost always logged in to a Unix box which is in US and the times shown for every command used (e.g. date modified when using ls) are in the US format. Are there any ways I can change the timezone temporarily for that given session so that I can view the times shown as the command outputs for my timezone (e.g. Japan Time Zone JST)?

2 Answers 2

12

Most programs (except for some ill-behaved GUI programs) use the timezone given by TZ environment variable, if it is set.

To change the timezone for one command:

TZ=Asia/Tokyo ls

To change the timezone for the session:

export TZ=Asia/Tokyo

Good shells (read zsh) provide completion for supported timezone names if you press Tab after TZ=.

If you want to change the time display format (order of elements, names of days and months, and so on), set the environment variable LC_TIME (LC_TIME=jp_JP, I guess).

1
  • Thank you, though auto-completion failed me even when using ZSH.
    – sasuke
    Sep 14, 2010 at 7:48
3

Give this a try:

export TZ=Asia/Tokyo
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .