How to Check Timezone in Linux
There are a number of time management utilities available on Linux such as timedatectl, date, etc by which you can view the current timezone in your Linux system. In this article, we will be discussing some ways by which you can check the system timezone in Linux.
Method 1: Using the command “timedatectl”
We can use the timedatectl command to display the timezone along with other information. We can check for the timezone-related info from the output.
As we can see in the above example, we can easily find the timezone-related info which is “Asia/Kolkata ( IST, +0530)” in the above output screenshot.
Method 2: Using pipeline feature of Linux with timedatectl and grep command
We can use the pipeline feature of Linux ( output from one command becomes the input of another command ) to find out the timezone. In this case, the output generated from the timedatectl command is searched for a keyword, which in our case is “Time Zone” and we only get the relevant output finally.
timedatectl | grep "Time zone"
In the above example, we have only got the required output “Time zone: Asia/Kolkata ( IST, +0530)” as compared to the previous method in which the only timedatectl was used. This can be a better method if you do not want to search for the required line in the output by yourself as in the previous method.
Method 3: Using cat command
We can use the cat command and the required file to display the timezone. the cat command displays the contents of a file and for our case, in order to find the timezone, we will search for a file named timezone in /etc Linux directory. etc is a Linux directory that contains all the system configuration files.
cat /etc/timezone OR cd /etc cat timezone
Using the first command “cat /etc/timezone”
First go to the Linux directory /etc and then type the command cat timezone.
Method 4: Using the date command
We can use the date command to view the timezone. Simply type the Linux command date in the terminal and you will get the required output.
As we can see from the above example, We have used the date command and timezone is displayed, which in our case is IST.