Get the Current Timezone of a Ubuntu Machine via the Terminal
What terminal command can you use to determine the current timezone your Ubuntu machine is using?
We'll go over two methods.
Method 1 - timedatectl
You can use the
timedatectl command with no other arguments:
This will output information about the time and date settings on your machine:
Local time: Wed 2021-12-08 13:47:30 EST Universal time: Wed 2021-12-08 18:47:30 UTC RTC time: Wed 2021-12-08 18:47:30 Time zone: America/New_York (EST, -0500) Network time on: yes NTP synchronized: yes RTC in local TZ: no
In the example output above, it shows that the
EST timezone is being used.
Method 2 - /etc/timezone File
On Ubuntu, the timezone being used is stored in the
You can use the cat command to read and output the contents of that file:
That command will output your machine's current timezone:
Thanks for reading and happy coding!