JIYIK CN >

Current Location:Home > Learning > OPERATING SYSTEM >

NTP in Linux

Author:JIYIK Last Updated:2025/03/23 Views:

NTP is a core protocol used by most IT infrastructures. Its purpose is to synchronize date and time information.

However, it is very important to configure NTP for your servers, clients, and other network devices. NTP uses a UDP port number, which is 123 by default.

In this article, we will explain the use of NTP, we will also see the sample execution of the commands along with necessary explanations to make the topic easier to understand.


Network Time Protocol (NTP) in Linux

An example is shared below where we illustrate the use of command NTP in Linux. The command will look like this:

$ systemctl status ntp

We printed the NTP service status list through the above command.

After executing the above command, you will get the output as shown below.

ntp.service - Network Time Service
  Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
  Active: active (running) since Sun 2022-08-14 14:23:48 PST; 10h left
    Docs: man: ntpd (8)
Main PID: 80903 (ntpd)
   Tasks: 2 (limit: 3476)
  Memory: 3.2M
CGroup: /system.slice/ntp.service
L80901 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -U 131:139
Aug 14 03:26:39 ubuntu ntpd[80903]: Soliciting pool server 62.12.173.11
Aug 14 03:26:42 ubuntu ntpd[80903]: Soliciting pool server 91.189.89.198
Aug 14 03:27:45 ubuntu ntpd[80903]: Soliciting pool server 2001:4f8:110: 12c8: :2:123
Aug 14 03:27:47 ubuntu ntpd[80903]: Soliciting pool server 91.189.94.4,
Aug 14 03:28:51 ubuntu ntpd[80903]: Soliciting pool server 2001:8a8: 1005:1::11
Aug 14 03:28:53 ubuntu ntpd[80903]: Soliciting pool server 2001:67c:1560:8003::07
Aug 14 03:29:38 ubuntu ntpd[80903]: kernel reports TIME ERROR: Ox41: Clock Unsynchronized
Aug 14 03:29:57 ubuntu ntpd[80903]: Soliciting pool server 2001:440:1880:5555: :2
Aug 14 03:29:58 ubuntu ntpd[80903]: Soliciting pool server 2001:67c:1560:8003: :08
Aug 14 03:31:02 ubuntu ntpd[80903]: Soliciting pool server 2001:a98:11::40

请注意, the commands shared in this article are only applicable to Linux environment.

Previous:Creating a Progress Bar in Bash

Next: None

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

Creating a Progress Bar in Bash

Publish Date:2025/03/23 Views:94 Category:OPERATING SYSTEM

A progress bar is a visual indicator that shows the progress of a task, such as a long-running script or command. It can be used to provide feedback to the user about the status of a task and can also help estimate the time remaining before

Redirecting Stderr and Stdout to a file in Bash

Publish Date:2025/03/23 Views:187 Category:OPERATING SYSTEM

In this article, we will discuss standard output and standard error in Linux. We will see how to redirect standard output and standard error in Bash. Let us start by understanding the terms standard output and standard error in Linux. Stand

Deleting Duplicate Lines in Bash

Publish Date:2025/03/23 Views:123 Category:OPERATING SYSTEM

Duplicate entries can cause a variety of problems in Bash scripts, such as incorrect or inconsistent results, and they can also make the script difficult to maintain. Removing duplicate entries from a script is often necessary to avoid thes

Count unique lines in a file in Linux

Publish Date:2025/03/23 Views:190 Category:OPERATING SYSTEM

Counting unique lines in a file is a common task in Linux, and there are a number of different tools and methods that can be used to perform this operation. In general, the appropriate method depends on the specific requirements and constra

Counting files in a directory in Bash

Publish Date:2025/03/23 Views:178 Category:OPERATING SYSTEM

Counting how many files are in a directory is a common task in Bash, and there are a number of different tools and methods that can be used to perform this operation. In general, the appropriate method depends on the specific requirements a

Execute commands in a variable in a Bash script

Publish Date:2025/03/23 Views:111 Category:OPERATING SYSTEM

This article is about storing Bash commands in a variable and then executing it directly from that variable. First, we will discuss the various ways to execute commands contained in a variable, followed by several script examples. Let’s g

Bash variable multiplication

Publish Date:2025/03/23 Views:150 Category:OPERATING SYSTEM

This article explains how to multiply two variables in Bash. Multiplying variables in Bash Multiplying two variables is a simple operation in Bash. We can use the arithmetic operator * to multiply two numbers in Bash. In Bash, multiplicatio

Bash md5sum command

Publish Date:2025/03/23 Views:116 Category:OPERATING SYSTEM

This article explains how to use the md5sum command in Bash. Bash md5sum command md5sum command prints the 32 character and 128 bit checksum of a given file. This command converts the file into a hash using the MD5 algorithm; the syntax of

Sorting Arrays in Bash

Publish Date:2025/03/23 Views:73 Category:OPERATING SYSTEM

Sorting an array is a very common task in any programming language. In Bash scripting, we can also accomplish this task in two different ways. The first one uses any sorting algorithm and the second one uses a built-in keyword in Bash scrip

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial