Inspect localtime with ls -l /etc/localtime
In addition to the /etc/timezone
file, Linux systems often use a symbolic link at /etc/localtime
to point to the actual timezone data file. This symbolic link tells the system which timezone rules to use.
A symbolic link (or symlink) is a special type of file that points to another file or directory. It's like a shortcut.
We can use the ls -l
command to inspect this symbolic link. The ls
command lists directory contents, and the -l
option provides a long listing format, showing details like permissions, ownership, size, and where a symbolic link points.
Type the following command in your terminal and press Enter:
ls -l /etc/localtime
You should see output similar to this:
lrwxrwxrwx 1 root root ... /etc/localtime -> ../usr/share/zoneinfo/Etc/UTC
Look at the end of the output. The ->
symbol indicates that /etc/localtime
is a symbolic link, and it points to /usr/share/zoneinfo/Etc/UTC
. This path /usr/share/zoneinfo/
contains the actual timezone data files for various regions and cities.
This confirms that the system's time is being interpreted according to the rules defined in the linked timezone data file.
You have now learned three different ways to check the timezone on a Linux system: using timedatectl
, viewing /etc/timezone
, and inspecting the /etc/localtime
symbolic link.
Click Continue to complete this lab.