Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to Check Timezone in Linux

  • Last Updated : 17 Jun, 2021

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.

Syntax : 

timedatectl

Example :

Using the command  timedatectl to display timezone

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.

Syntax :

timedatectl | grep "Time zone"

Example :

Using pipeline feature of Linux on timedatectl and grep to display timezone

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.

Syntax :

cat /etc/timezone

OR

cd /etc
cat timezone

Example 1:

Using the first command “cat /etc/timezone”

using cat /etc/timezone commands to find the timezone

Example 2:

First go to the Linux directory /etc and then type the command cat timezone

A step by step process to display timezone using cd and cat commands

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.

Syntax :

date

Example :

Using date command to display timezone

As we can see from the above example, We have used the date command and timezone is displayed, which in our case is IST.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!