rdate Command in Linux with Examples

This tutorial explains Linux “rdate” command, options and its usage with examples.

rdate – get the time via the network

DESCRIPTION

rdate displays and sets the local date and time from the host name or address given as the argument. The time source may be an RFC 868 TCP protocol server,or an RFC 2030 protocol SNTP/NTP server. By default, rdate uses the RFC 868 TCP protocol.
NOTE:
1) Remote server should run the time service in port 37.
2) Firewall should not block port 37.

A list of Nework Time servers is available on: http://ntp.isc.org/bin/view/Servers/WebHome

SYNOPSIS

rdate [-46acnpsuv] [-o port] host

advertisement
advertisement

OPTIONS :

-4
Forces rdate to use IPv4 addresses only.
-6
Forces rdate to use IPv6 addresses only.
-a
Use the adjtime call to gradually skew the local time to the remote time rather than just hopping.
-c
Correct leap seconds. Sometimes required when synchronizing to an NTP server.
-n
Use SNTP instead of the RFC 868 time protocol.
-o port
Use port port instead of port 37.
-p
Do not set, just print the remote time.
-s
Do not print the time.
-u
Use UDP instead of TCP as transport.
-v
Verbose output. Always show the adjustment.

EXAMPLES

1. Print the time returned by the remote machine.

Note: Join free Sanfoundry classes at Telegram or Youtube
$ rdate -p 192.168.1.5

2. Set the system time to the time returned by the remote machine (Need Root permission).

# rdate -s remote.pc.com

3. Use UDP instead of TCP as the transport.

advertisement
# rdate -u myserver

4. Use syslog to log errors and output

# rdate -l myserver

5. To to set the time through an ssh tunnel, use something like so:

advertisement
# ssh -f -L 10037:time.example.com:37 tyr.example.com sleep 10
# rdate -a -o 10037 locahost

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.