🖥️ntp
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the ntp command with important options and switches using examples.
3 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ███╗ ██╗████████╗██████╗
# ████╗ ██║╚══██╔══╝██╔══██╗
# ██╔██╗ ██║ ██║ ██████╔╝
# ██║╚██╗██║ ██║ ██╔═══╝
# ██║ ╚████║ ██║ ██║
# ╚═╝ ╚═══╝ ╚═╝ ╚═╝
# alias für offset:
alias ntpsync='service ntp stop ; ntpd -g -q ; service ntp start'
# Verify ntpd running:
service ntp status
# Start ntpd if not running:
service ntp start
# Display current hardware clock value:
sudo hwclock -r
# Apply system time to hardware time:
sudo hwclock --systohc
# Apply hardware time to system time:
sudo hwclock --hctosys
# Set hwclock to local time:
sudo hwclock --localtime
# Set hwclock to UTC:
sudo hwclock --utc
# Set hwclock manually:
sudo hwclock --set --date="8/10/15 13:10:05"
# Query surrounding stratum time servers
ntpq -pn
# Config file:
/etc/ntp.conf
# Driftfile:
location of "drift" of your system clock compared to ntp servers /var/lib/ntp/ntp.drift
#-------------------------------------------------#
# Vorgehensweise bei ntp offset
#--------------------------------#
service ntp stop
ntpd -g -q
# Die Option -g bedeutet, dass ntpd auch synchronisiert, wenn die Zeit mehr als 1000 Sekunden abweicht. Die Option -q bedeutet, dass ntpd nur einmal ausgeführt wird.
service ntp start
hwclock --systohc
# die Uhr in die Hardwareclock schreiben, denn sonst kommt der Server eventuell nach einem Boot mit einer völlig falschen Zeit hoch.
# Verify ntpd running:
service ntp status
# Start ntpd if not running:
service ntp start
# Display current hardware clock value:
sudo hwclock -r
# Apply system time to hardware time:
sudo hwclock --systohc
# Apply hardware time to system time:
sudo hwclock --hctosys
# Set hwclock to local time:
sudo hwclock --localtime
# Set hwclock to UTC:
sudo hwclock --utc
# Set hwclock manually:
sudo hwclock --set --date="8/10/15 13:10:05"
# Query surrounding stratum time servers
ntpq -pn
# Config file:
/etc/ntp.conf
# Driftfile:
location of "drift" of your system clock compared to ntp servers
/var/lib/ntp/ntp.drift
# example config
tinker panic 0
server ntptime.lxu.io burst iburst
driftfile /var/lib/ntp/drift/ntp.drift
logfile /var/log/ntp
##############################################
# BASH script to synchronize with NTP server - This is a simple script (can be safely placed in a cron) to sync your machine with the default NTP server
##############
service ntpd stop
ntpdate 156.54.18.6 // replace 156.54.18.6 with correct server IP address
ntpdate 156.54.18.6
ntpdate 156.54.18.6
ntpdate 156.54.18.6
service ntpd start
chkconfig ntpd on
##############
#==============================##==============================#
# CMD NTP #
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command ntp in a clear format. This allows users to quickly access the needed information for ntp without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for ntp are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.