How to Use tzselect on Linux to Set Your Timezone Interactively
Linuxcommands
The tzselect command on Linux can be used to choose the time zone and show the correct value for the TZ variable.
Its operation is simple: first you must choose the continent:
# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa 7) Europe
2) Americas 8) Indian Ocean
3) Antarctica 9) Pacific Ocean
4) Asia 10) geographical coordinates
5) Atlantic Ocean 11) TZ
6) Australia
Then you must choose the country:
Please select a country whose clocks agree with yours.
1) Anguilla 12) Cayman Islands
2) Antigua 13) Chile
3) Argentina 14) Colombia
4) Aruba 15) Costa Rica
5) Bahamas 16) Cuba
6) Barbados 17) Curaçao
7) Belize 18) Dominica
8) Bolivia 19) Dominican Republic
9) Brazil 20) Ecuador
( ... )
And finally the Time Zone:
Please select one of the following timezones.1) Atlantic islands 2) Pará (east); Amapá3) Brazil (northeast: MA, PI, CE, RN, PB)4) Pernambuco 5) Tocantins 6) Alagoas, Sergipe 7) Bahia 8) Brazil (southeast)
( ... )
Once the desired Time Zone is selected, tzselect asks you to confirm the settings:
The following information has been given: Brazil Brazil (southeast: GO, DF, MG, ES, RJ, SP, PR, SC, RS)Therefore TZ='America/Sao_Paulo' will be used.Selected time is now: Sat Oct 19 11:56:56 -03 2019.Universal Time is now: Sat Oct 19 14:56:56 UTC 2019.Is the above information OK?1) Yes2) No
And then it creates the command line for setting the TZ variable and also indicates where it should be saved:
You can make this change permanent for yourself by appending the line TZ='America/Sao_Paulo'; export TZto the file '.profile' in your home directory; then log out and log in again.
Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.
Like it? Share
That was just one piece. The course teaches the whole path — from your first command to exam day.