Linux Commands - tzselect (time zone select)

by
Jeremy Canfield |
Updated: March 09 2020
| Linux Commands articles
The tzselect command can be used to change the time zone of the system. Changing the time zone using the tzselect command is not permanent. After a reboot, the time zone will revert to the time zone set in /etc/timezone file.
The tzselect command will first prompt you to select a contitent or ocean.
[root@server1 ~]# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format
#?
Let's say you select 2 (Americas). You will next be prompted to select a country.
Please select a country.
1) Anguilla
2) Antigua & Barbuda
3) Argentia
4) Aruba
5) Bahamas
. . .
#?
Let's say ou select 49 (United States). You will next be prompted to select a time zone region.
Please select one of the following time zone regions.
1) Eastern (most areas)
2) Eastern - MI (most areas)
3) Eastern - KY (Louisville area)
4) Eastern - KY (Wayne)
5) Eastern - IN (most areas)
. . .
#?
Let's say you select 11 (Centeral most areas). You will be prompted to confirm your selections are OK.
The following information has been given:
United States
Central (most areas)
Therefore TZ='Americas/Chicago' will be used.
Local time is now: Mon Oct 24 10:47:23 CDT 2016.
Universal time is now: Mon Oct 24 15:47:23 UTC 2016.
Is the above information OK?
1) Yes
2) No
#?
Let's say you select 1 (Yes). You will receive a confirmation that the time zone has been updated.
You can make this change permanent for yourself by appending the line
TZ='America/Chicago'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
America/Chicago
Did you find this article helpful?
If so, consider buying me a coffee over at
Comments
August 09 2023 by aasdfrfrrff
frf