Host の canonical name を取得するワンライナー

python -c "import socket; import sys; print(socket.getaddrinfo(sys.argv[1], 0, socket.AF_INET, 0, socket.IPPROTO_TCP, socket.AI_CANONNAME)[0][3])" YOUR_HOST_NAME

Published: 2018-03-06(Tue) 04:19