This tutorial will help you to find time of different time zones on Linux command prompt or shell scripts. For example, your system is running with UTC timezone. When you execute “date” command on terminal, it will show you the current time of the timezone configured on your system. How do you find the time in other timezone without changing timezone of your system (eg: current EST time)
View Current EST Time
- Search on Google – Just open google.com and enter “current est time” in search bar. This will show you the current time in EST timezone.
- View current est time on linux command line – You can also view the current time of any timezone, no matter what timezone is configured on your system. No need to change timezone of your system to view current time in other timezone like current est time.
Output>Sunday 06 December 2020 06:12:59 AM EST
Similarly, you can search for current time in other timzones, like:
# Current time in UTC
# Current time in GMT
# Current time in PDT (Pasific Time)
# Current time in America/New_York
# Current time in America/Virgin
# Current time in Europe/London
# Current time in Europe/Paris
# Current time in Australia/Sydney
Use Current EST Time in Shell Scripts
Getting time of different time zones is useful while writing scripts. For example, you need to check current time in some other timezone that current system.
Just in case, your system is running in UTC timezone and your script required the current EST time. The below script will help you to find current EST time and store it in a variable. Which you can further use in your script.Shell1234567#!/bin/bash# Store current EST time in a variableEST_TIME=$(TZ="EST" date)# Print value stored in variableecho "Current time - $EST_TIME"
Hope this tutorial helped you to find current time in different-2 time zones on Linux command line.