= Linux Clock =

On Linux, the '''clock''' generally uses UTC time with a timezone offset in software, as opposed to local time.

<<TableOfContents>>

----



== Date and Time ==

Use '''`date(1)`''' as the root user to set the current date and time.

{{{
# January 1st, 2001 at 12:30
sudo date 0101011230
}}}

Use '''`hwclock(1)`''' or [[TimeDateCtl|timedatectl(1)]] to check the CMOS clock.

----



== Timezone ==

The configured timezone is set in `/etc/localtime`. By standard convention, this should be a symbolic link to a pre-prepared file, typically under `/usr/share/zoneinfo`.

To check the current configuration, try:

{{{
realpath /etc/localtime
}}}

To change the configuration, try:

{{{
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
}}}

For [[Linux/Debian|Debian]]-based distributions, consider using the interactive '''`dpkg-reconfigure tzdata`''' script.

For `systemd`-capable systems, consider using [[TimeDateCtl#Timezone|timedatectl(1)]].

Some utilities will also respect a `TZ` environment variable.

{{{
export TZ=America/New_York
date
}}}



----
CategoryRicottone