How to Check Current Time in Linux

1. Viewing and Modifying Linux Timezone

1.1 Check Current Timezone

Command: "date -R"

1.2 Modify and Set Linux Server Timezone

Method A

Command: "tzselect"

Method B (RedHat Linux and CentOS Only)

Command: "timeconfig"

Method C (For Debian)

Command: "dpkg-reconfigure tzdata"

1.3 Copy the Corresponding Timezone File to Replace the System Timezone File; or Create a Symbolic Link

cp /usr/share/zoneinfo/$MainTimezone/$SubTimezone /etc/localtime

For example: To set the timezone for China, use Asia/Shanghai (+8)

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

2. Viewing and Modifying Linux Time

2.1 Check Time and Date

Command: "date"

2.2 Set Time and Date

For example: Command to set the system date to November 3, 2009

Command: "date -s 11/03/2009"

Command to set the system time to 5:55:55 PM

Command: "date -s 17:55:55"

2.3 Write Current Time and Date to BIOS to Avoid Reset After Reboot

Command: "hw

Leave a Comment

Your email address will not be published.