by robey

How can I make the "whois" command work like before?

Because there are now more than one domain registration service (DRS), a "whois" query on a domain name just tells you who registered the domain. So you have to do an initial query of:

$ whois

and then, once you know the whois server to use, do:

$ whois

so it's become a two-step process, which is okay, but it annoys old fogeys like me who are used to being able to find out "whois" info with a single command.

Perl to the rescue! Enter this line into your .bashrc:

function xwhois { whois $1 | perl -le 'while (<>) { chomp; /Whois Server: (\S+)/i && ($server = $1); print; } if ($server) { open(FD, "whois '$1'\@$server|"); while (<FD>) { chomp; print; } }' }

Then you can do it all in one step:

$ xwhois



Read more of   The Yak's Frequently Questioned Answers   (mod.2010-02-10)

421.   What is a Brosef?   [jake/2005-02-18]
215.   what is the maximum length of a file name in mac os 9?   [jesse/2001-04-18]
125.   How does the % operator work in Python?   [rupe/2000-09-27]
96.   Where can I find information on in-vehicle computer systems?   [rupe/2000-05-24]
94.   How do I boot my Sparc Classic/Sparc Classic X/Sparc 5/Sparc 10 without a keyboard or monitor?   [rupe/2000-05-12]
91.   Should the answer to an FQA consist entirely of an external link?   [macki/2000-05-06] ( strick/2002-01-23 )
84.   How do I send mail from a Python script?   [rupe/2000-05-10]
73.   How many Zelda games are there?   [vonguard/2001-06-25] ( combee/2001-07-10 mennonite/2001-03-27 )
67.   Where are all the IN-N-OUTs around here?   [strick/2000-02-23]
60.   Where can i find out about taking the java certification exam?   [jesse/2000-02-15]
35.   What are HAW FLAKES?   [strick/2002-11-14]