Change Time Zone on CentOS 7

If time zone is wrong on CentOS, you can come across weird issues. One of the things I came cross is Jenkins grabbing a wrong commit. Gotta fix the time zone.

Check the Current Time Zone

ll /etc/localtime

This command shows which time zone the system is set currently.

How to List Available Time Zones

Let’s list the available time zones.

timedatectl list-timezones

It shows quite a long list of time zones. Let’s grep it so you can find the one you want.

timedatectl list-timezones | grep Lo

It lists time zones that contains “Lo”. The time zone I want to use is America/Los_Angeles. I’m going to set the time zone to it.

Change the Time Zone

I’m going to change the time zone to America/Los_Angeles.

sudo timedatectl set-timezone America/Los_Angeles

Execute date command to check the current date, time and time zone.

Thu Oct 31 18:57:05 PDT 2019

Building Bash Muscle (13)

Let’s talk about some cook tips with the terminal. These tips are not directly related to bash itself but very useful tips

Ctrl+L will clear the screen but it does not clear the buffer. If you scroll up, you get to see the previously executed command result.

If you do Ctrl+A, the cursor will move to the beginning of the line. You can accomplish the same thing with Home button.

Ctrl+Right Arrow lets you move the cursor forward by a word. Ctrl+Left Arrow lets you move the cursor backward by a word.

Alt+U capitalizes all the letters after the cursor. Alt+L lowers all the letters after the cursor.

Ctrl+S stops output of the screen and Ctrl+Q resumes it.

!! repeats the last command.

Alt+D removes the word right after the cursor. Ctrl+K removes everything after the cursor. Ctrl+U removes everything before the cursor.

These tips and tricks should make your bash life a little more productive. 🙂