• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

timedatectl: command not found

by admin

A new command that was introduced in systemd-based distributions that enables you to manage many aspects of time is timedatectl. When used without any arguments, this command shows detailed information about the current time and date. It also displays the time zone your system is in, in addition to information about the use of NTP network time and information about the use of DST.

# timedatectl
                Local time: Mon 2019-06-10 08:27:57 EDT
            Universal time: Mon 2019-06-10 12:27:57 UTC
                  RTC time: Mon 2019-06-10 12:27:57
                 Time zone: America/New_York (EDT, -0400)
 System clock synchronized: yes
               NTP service: active
           RTC in local TZ: no

Most Common Options with timedatectl Command

Command Explanation
status Shows the current time settings
set-time TIME Sets the current time
set-timezone ZONE Sets the current time zone
list-timezone Shows a list of all time zones
set-local-rtc [0|1] Controls whether the RTC (the real-time clock, normally referred to as the hardware clock) is in local time
set-ntp [0|1] Controls whether NTP is enabled

If you encounter below error:

timedatectl: command not found

you may try installing below package as per your choice of distribution.

Distribution Command
Debian apt-get install systemd
Ubuntu apt-get install systemd
Arch Linux pacman -S systemd
Kali Linux apt-get install systemd
CentOS yum install systemd
Fedora dnf install systemd
Raspbian apt-get install systemd

timedatectl Command Examples

1. We can change the date using the following command:

# timedatectl set-time 2014-07-19

2. The time can be set using the same option with time as the argument, shown as follows:

# timedatectl set-time 23:02:23

3. NTP time synchronization can be enabled and disabled with the following command; though, it uses the news system service manager to enable and disable the time service:

# timedatectl set-ntp yes

4. To list available time zones:

# timedatectl list-timezones

5. If you have found the right time zone, write it down and use it in the next command; for example, if you are located in Germany and are near the city of Berlin, use the following command:

# timedatectl set-timezone Europe/Berlin

6. Use timedatectl again to check if your local time is correct now:

# timedatectl | grep "Local time"

Summary

The newer systemd-based distributions include a simple command to display and manage time and date settings on the host system: timedatectl. This really is a godsend to us as administrators; even if we only use the command to display the output, this one command will display the time, timezone, and NTP settings.

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to add words to the dictionary cracklib uses for validating passwords against known dictionary words
  2. How to Reserve a Port Range for a Third Party Application in CentOS/RHEL
  3. How to Change or Rename a Mount Point in Linux
  4. CentOS / RHEL 5,6 : How to Change the timezone
  5. CentOS / RHEL 6 : How to Boot into single user mode
  6. Manage ASM Audit Files with syslog – configure lograte and auditing
  7. The Ultimate Beginner’s Guide to Static Website Hosting With Google Firebase (for FREE)
  8. CentOS / RHEL 5 : How to install and configure vsftpd server
  9. CentOS / RHEL : How to get the date and time of executed command in the history command output
  10. CentOS/RHEL: Mount Command Fails With “mount: does not contain SELinux labels”

You May Also Like

Primary Sidebar

Recent Posts

  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found
  • macof: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright