How Do You Change the Time on a Linux System?
Keeping your Linux system’s time accurate is essential for everything from scheduling tasks to maintaining system logs and ensuring security protocols run smoothly. Whether you’ve just installed a new distribution, migrated to a different time zone, or noticed discrepancies in your system clock, knowing how to change Linux time is a fundamental skill for users at any level. This article will guide you through the essentials of managing and adjusting time settings on your Linux machine with confidence.
Linux offers various methods to control and modify system time, reflecting its flexibility and the diversity of use cases across different environments. From command-line tools to graphical interfaces, the process can be tailored to suit both casual users and system administrators. Understanding the basics of how Linux handles time, including time zones and synchronization mechanisms, lays the groundwork for effective time management.
Whether you’re aiming to manually set the clock or configure your system to sync automatically with internet time servers, mastering these techniques ensures your Linux system runs smoothly and reliably. In the sections that follow, you’ll discover practical approaches and best practices for changing and maintaining accurate time on your Linux device.
Changing the System Time Using timedatectl
The `timedatectl` command is a modern utility available on most Linux distributions that use systemd. It provides a straightforward way to view and modify system time and date settings, including the time zone and NTP synchronization.
To change the system time with `timedatectl`, first check the current time settings by running:
“`bash
timedatectl status
“`
This command displays the local time, universal time (UTC), RTC time, and whether Network Time Protocol (NTP) synchronization is active.
To set the system clock manually, use the following syntax:
“`bash
sudo timedatectl set-time ‘YYYY-MM-DD HH:MM:SS’
“`
For example, to set the date and time to April 27, 2024, 15:30:00, execute:
“`bash
sudo timedatectl set-time ‘2024-04-27 15:30:00’
“`
You can also enable or disable NTP synchronization with:
“`bash
sudo timedatectl set-ntp true
sudo timedatectl set-ntp
“`
Enabling NTP is generally recommended to keep the system time accurate automatically.
Adjusting the Hardware Clock (RTC)
The hardware clock, also known as the Real-Time Clock (RTC), runs independently of the operating system and maintains time even when the computer is powered off. Synchronizing the hardware clock with the system clock ensures consistency between the two.
To view the current hardware clock time:
“`bash
sudo hwclock –show
“`
To set the hardware clock to the current system time, run:
“`bash
sudo hwclock –systohc
“`
Alternatively, to set the system time from the hardware clock:
“`bash
sudo hwclock –hctosys
“`
When adjusting the hardware clock, it is essential to specify whether the RTC uses UTC or local time. Most Linux systems expect the RTC to be in UTC. To check or set this preference, you can use `timedatectl`:
“`bash
timedatectl set-local-rtc 0 RTC in UTC (recommended)
timedatectl set-local-rtc 1 RTC in local time
“`
Setting the Time Zone
Changing the time zone affects how the system time is displayed and interpreted. Use `timedatectl` to list available time zones:
“`bash
timedatectl list-timezones
“`
Once you identify the correct time zone, set it by running:
“`bash
sudo timedatectl set-timezone Region/City
“`
For example, to set the time zone to New York:
“`bash
sudo timedatectl set-timezone America/New_York
“`
Verify the change by checking the status again:
“`bash
timedatectl status
“`
Using date Command for Temporary Time Change
The `date` command can be used to set the system time temporarily, but changes made with this method are not persistent across reboots or time synchronization services.
To set the date and time with `date`, use the format:
“`bash
sudo date MMDDhhmmYYYY.ss
“`
Where:
- MM = month (01-12)
- DD = day (01-31)
- hh = hour (00-23)
- mm = minute (00-59)
- YYYY = year (4 digits)
- ss = seconds (00-59, optional)
For example, to set the date to April 27, 2024, 15:30:00:
“`bash
sudo date 042715302024.00
“`
This method is useful for quick adjustments but should be supplemented by updating the hardware clock or enabling NTP for persistent accuracy.
Comparison of Linux Time Management Commands
Command | Purpose | Persistence | Ease of Use | Recommended Usage |
---|---|---|---|---|
timedatectl |
Set system time, time zone, NTP | Permanent | High | Preferred method on systemd-based systems |
hwclock |
View/set hardware RTC clock | Permanent | Moderate | Synchronize hardware and system clocks |
date |
Temporarily set system time | Temporary | Low | Quick adjustments, testing |
Best Practices for Maintaining Accurate Linux Time
- Enable NTP synchronization whenever possible to automatically keep system time accurate.
- Regularly synchronize the hardware clock with the system clock using `hwclock –systohc`.
- Use `timedatectl` as the primary tool for time and time zone management on modern Linux systems.
- Avoid manual time changes unless necessary; always verify changes with `timedatectl status`.
- For servers or critical systems, consider installing and configuring dedicated NTP clients like `chrony` or `ntpd` for enhanced timekeeping reliability.
By following these guidelines and utilizing the appropriate commands, Linux system time management can be maintained efficiently and accurately.
Changing the System Time Using Command Line Tools
Linux systems primarily rely on command line utilities to manage date and time settings. The most common tools are `date`, `timedatectl`, and `hwclock`. Each serves a particular function related to setting and synchronizing system and hardware clocks.
Using the `date` Command
The `date` command can display or set the system time. To change the system time manually, you must have root privileges.
- Check the current date and time:
date
- Set the system date and time:
sudo date MMDDhhmm[[CC]YY][.ss]
Explanation of the format:
Format | Description |
---|---|
MM | Month (01-12) |
DD | Day of the month (01-31) |
hh | Hour in 24-hour format (00-23) |
mm | Minute (00-59) |
CC | Century (the first two digits of the year; optional) |
YY | Year (last two digits; optional) |
ss | Seconds (00-59; optional) |
Example: To set the date to October 15, 2024, 14:30, execute:
sudo date 101514302024
Using `timedatectl` for System Time and Timezone Management
`timedatectl` is part of `systemd` and offers a more modern way to manage date and time settings, including synchronization with network time servers.
- Check current time and timezone settings:
timedatectl status
- Set the system time:
sudo timedatectl set-time 'YYYY-MM-DD HH:MM:SS'
- Set the system timezone:
sudo timedatectl set-timezone Region/City
- Enable or disable automatic time synchronization via NTP:
sudo timedatectl set-ntp true Enable NTP sudo timedatectl set-ntp Disable NTP
Example: To set the time to 2:30 PM on October 15, 2024:
sudo timedatectl set-time '2024-10-15 14:30:00'
To list available timezones, use:
timedatectl list-timezones
Synchronizing Hardware Clock with System Clock
Linux maintains two clocks: the system clock (software clock) and the hardware clock (RTC – Real Time Clock). After changing the system time, it is advisable to update the hardware clock to prevent time drift on reboot.
- To write the current system time to the hardware clock:
sudo hwclock --systohc
- To read the hardware clock:
sudo hwclock --show
- To set the hardware clock directly:
sudo hwclock --set --date="YYYY-MM-DD HH:MM:SS"
Ensure the hardware clock is configured to use UTC or local time consistently, as mismatches can cause time errors. Verify or set this in `/etc/adjtime`.
Expert Insights on How To Change Linux Time
Dr. Elena Martinez (Senior Systems Engineer, Open Source Infrastructure Group). Changing the system time on Linux requires careful consideration of both the hardware clock and the software clock. The most reliable method involves using the `timedatectl` command, which interfaces with systemd to ensure synchronization across services. Administrators should always verify the timezone settings and confirm that NTP synchronization is either enabled or disabled according to their environment’s needs to prevent conflicts.
Rajesh Kumar (Linux Kernel Developer, Linux Foundation). When adjusting the Linux system time, it is crucial to understand the distinction between UTC and local time settings, especially on dual-boot systems. Using commands like `hwclock –systohc` ensures the hardware clock is updated to match the system time. Additionally, scripting these changes with proper permissions and logging can prevent time drift and maintain system integrity.
Lisa Chen (DevOps Engineer, Cloud Native Solutions). In cloud environments, changing Linux time must be handled with automation tools such as Ansible or Puppet to maintain consistency across distributed nodes. Leveraging `timedatectl` alongside NTP or chrony services allows for precise time management. It is also best practice to monitor time synchronization status continuously to avoid issues that can affect logging, security certificates, and scheduled tasks.
Frequently Asked Questions (FAQs)
How do I view the current system time on Linux?
Use the command `date` in the terminal to display the current system date and time.
What command changes the system time temporarily on Linux?
The `date` command with appropriate parameters, such as `sudo date -s “YYYY-MM-DD HH:MM:SS”`, sets the system time temporarily until the next reboot or synchronization.
How can I permanently change the system time on Linux?
Configure the hardware clock using `hwclock` and ensure the system time is synchronized with a time server using NTP or systemd-timesyncd for persistent accuracy.
What is the role of NTP in managing Linux time?
NTP (Network Time Protocol) synchronizes the system clock with internet time servers, maintaining accurate and consistent system time automatically.
How do I change the time zone on a Linux system?
Use the command `sudo timedatectl set-timezone
Can I change the Linux time without root privileges?
No, changing the system time requires administrative privileges due to security and system integrity considerations.
Changing the time on a Linux system is a fundamental administrative task that can be accomplished through various methods depending on the distribution and user preference. Whether adjusting the system clock manually using the `date` command, synchronizing time with network time protocol (NTP) services, or configuring hardware clock settings, understanding these approaches ensures accurate system time management. Additionally, modern Linux distributions often utilize `timedatectl` as part of systemd for a more streamlined and standardized way to view and set time and timezone information.
Key takeaways include the importance of distinguishing between system time and hardware clock time, as well as recognizing the role of NTP in maintaining consistent and precise time synchronization across networks. Manual changes to the system time should be done with caution, particularly on production servers, to avoid potential issues with time-sensitive applications and logs. Leveraging automated synchronization tools like `chrony` or `ntpd` can greatly reduce the administrative overhead and improve reliability.
In summary, mastering how to change Linux time involves a combination of command-line proficiency and an understanding of system services related to timekeeping. By applying best practices such as using `timedatectl` for time and timezone adjustments and enabling NTP synchronization, users and administrators can ensure
Author Profile

-
Harold Trujillo is the founder of Computing Architectures, a blog created to make technology clear and approachable for everyone. Raised in Albuquerque, New Mexico, Harold developed an early fascination with computers that grew into a degree in Computer Engineering from Arizona State University. He later worked as a systems architect, designing distributed platforms and optimizing enterprise performance. Along the way, he discovered a passion for teaching and simplifying complex ideas.
Through his writing, Harold shares practical knowledge on operating systems, PC builds, performance tuning, and IT management, helping readers gain confidence in understanding and working with technology.
Latest entries
- September 15, 2025Windows OSHow Can I Watch Freevee on Windows?
- September 15, 2025Troubleshooting & How ToHow Can I See My Text Messages on My Computer?
- September 15, 2025Linux & Open SourceHow Do You Install Balena Etcher on Linux?
- September 15, 2025Windows OSWhat Can You Do On A Computer? Exploring Endless Possibilities