取得網路時間 (非更新系統時間)

Source: http://superuser.com/questions/635020/how-to-know-current-time-from-internet-from-command-line-in-linux

方法1

$ nc time.nist.gov 13
# Both commands query the timer server on TCP port 13 of the National Institute of Standards and Technology and output the received data on stdout.

nc 指令說明
This is nc from the netcat-openbsd package. An alternative nc is available in the netcat-traditional package.
usage: nc [-46bCDdhjklnrStUuvZz] [-I length] [-i interval] [-O length] [-P proxy_username] [-p source_port] [-q seconds] [-s source] [-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [destination] [port]

方法2

$ curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g'
# 取得google首頁上的時間標計
This entry was posted in Linux. Bookmark the permalink.