Linux TZ variable with examples

Home > Search
  by

The TZ (time zone) environmental variable can be used to store a particular time zone. view and set the time zone. If there is no output when echoing the TZ variable, this means the TZ variable does not contain a time zone.

[root@server1 ~]# echo $TZ

 

Also, env and set will not have have the TZ variable.

[root@server1 ~]# env | grep TZ

[root@server1 ~]# set | grep TZ

 

Export a certain timezone to the TZ variable.

[root@server1 ~]# export TZ=US/Central

 

After exporting a certain timezone to the TZ variable, echo $TZ will display the time zone.

[root@server1 ~]# echo $TZ
US/Central

 

Both ENV and SET will now contain the TZ variable.

[root@server1 ~]# env | grep TZ
US/Central

[root@server1 ~]# set | grep TZ
US/Central

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments