This tutorial explains Linux “rdate” command, options and its usage with examples.
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
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.
$ 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.
# 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:
# 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.
- Check Information Technology Books
- Practice Programming MCQs
- Apply for Programming Internship
- Check Linux Books