Changing server time zone — Ubuntu

This is very important when you have some programs scheduled to run using cron.

Display current timezone

cat /etc/timezone

Because I’m using New York timezone, this will display:
America/New_York

How to change the server timezone?

I’d like to change the server to Dubai timezone, so I’ll enter:

ln -sf /usr/share/zoneinfo/Asia/Dubai /etc/localtime

To list other countries timezone

cd /usr/share/zoneinfo/
ls

You’ll see folders like Africa, America and others. Let’s check America:

cd America
ls

You’ll see all American timezone. To change the timezone to New_York, use this:

ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

See the changes:

cat /etc/timezone

You should see this: America/New_York

Finally, we have to restart the cron service for cron to use the new timezone

sudo service cron restart

Leave a Reply

Your email address will not be published. Required fields are marked *