tokuhirom's blog

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
Created: 2018-03-06 13:19:31 +0900
Updated: 2018-03-06 13:19:31 +0900