In this article, I’ll explain how we may use ntpdate and ntptrace commands while working o debugging or troubleshooting NTP related issues. We already showed how to install and configure NTP in Linux Redhat/Centos and Ubuntu/Debian. What is a ntpupdate command in Linux? The ntpdate command is used to manually sync time with an NTP server when you don’t have NTP agent running. Note: ntpdate will only sync to the time server if the ntpd daemon is not running. Install ntpupdate command in Linux This package is installed on the system, but if it isn’t we can easily install it via yum as shown below: [root@linuxnix ~]# yum install ntpdate -y Loaded plugins: fastestmirror, presto Setting up Install Process Determining fastest mirrors * base: mirror.nus.edu.sg * extras: mirror.nus.edu.sg * updates: mirror.nus.edu.sg base | 3.7 kB 00:00 centos-sclo-rh | 2.9 kB 00:00 centos-sclo-rh/primary_db | 2.6 MB 00:04 extras | 3.4 kB 00:00 extras/primary_db | 29 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 4.7 MB 00:00 Resolving Dependencies --> Running transaction check ---> Package ntpdate.x86_64 0:4.2.6p5-10.el6.centos.2 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================== Installing: ntpdate x86_64 4.2.6p5-10.el6.centos.2 base 78 k Transaction Summary ====================================================================================================================================== Install 1 Package(s) Total download size: 78 k Installed size: 123 k Downloading Packages: Setting up and reading Presto delta metadata Processing delta metadata Package(s) data still...Read More
Author: Sahil Suri
What is NTP? Accurate system time is essential for the software and applications installed on the server to be able to operate correctly. NTP synchronizes very critically for financial and telemetric applications. The issue with system clock is with the passage of time; the system clock may become inaccurate owing to a variety of reasons like power failures, cheap hardware clocks, etc. To buy a uber accurate and costly crystal clock for each system is not a viable solution. This is where the Network Time Protocol (NTP) comes into the picture. What are NTP server and client? The NTP server: As said earlier to have an accurate and costly clock for each and every system is not a good solution. Thats where we have NTP servers on the Internet which have precise system times with the help of costly time crystal clocks. These servers intern synchronize with other NTP servers to have accurate system clocks. The NTP client: These are just NTP agents which keep local system time synchronize with internet-based or local NTP servers for keeping local time not to drift away. What actually NTP service do constantly monitor Internet-based NTP servers operates on UDP port number 123 and is used to synchronize system time with a reference source. The reference source, in this case, could be another server or a GPS clock. The package is generally installed on the...Read More
AWK is a powerful regular expression filtering and pattern matching scripting language. Please consider heading to awk tutorials section to read through our other awesome AWK tutorials which deep dive into different aspects of the language. In this tutorial, we look at how we can use AWK to print the header lines from a file or a command output along with the pattern being searched. While filtering output from certain commands or lengthy reports, it may be important to display the first line of the file or the header line to make sense of the rest of the output which is being displayed. Consider the below output. [sahil@linuxnix ~]$ df -hTP Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/vg_pbox6-lv_root ext4 18G 4.9G 12G 30% / tmpfs tmpfs 491M 80K 491M 1% /dev/shm /dev/sda1 ext4 477M 35M 418M 8% /boot /dev/sr0 iso9660 3.7G 3.7G 0 100% /media/CentOS_6.8_Final /dev/sdb ext4 488M 396K 462M 1% /u01 /dev/sdc ext4 488M 396K 462M 1% /u02 We would like to print only the ext4 type file systems but along with the header line as well to make sense of the values indicated by the respective fields. We could use grep to meet this requirement as done in the below command [sahil@linuxnix ~]$ df -hTP | grep -E "Filesystem|ext4" Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/vg_pbox6-lv_root ext4 18G 4.9G 12G 30% / /dev/sda1 ...Read More
Take this course
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.