I just needed to retrieve the IP address for a given host name for a Ruby project. What helped me to achieve this goal was the Socket class. In this example I want to get the IP address for google.com: >> Socket::getaddrinfo(‘google.com’, ‘www’, nil, Socket::SOCK_STREAM)[0][3] => “209.85.129.147″
Posts Tagged ‘hostname’
manual of the day… change hostname on Debian
Change hostname on Debian I wanted to change the hostname on my Debian Etch installation. The following worked: sudo vi /etc/hostname Change the hostname and save file and then sudo /etc/init.d/hostname.sh start
Recent Comments