[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Getting hostname

On Thu, 2002-02-14 at 20:19, Tony Nugent wrote:
> On Thu Feb 14 2002 at 17:34, seth vidal wrote:
> > Content-Type: text/plain
> > Content-Transfer-Encoding: quoted-printable
> Gnargh!  I *hate* quoted-UNprintable!!!!  (ugliness that appeard
> below fixed)

oh no. do you mean I gpg signed my mail in the compliant way.

> /sbin/ifconfig is now obselete, has been since the introduction of
> the 2.2.x kernels.
> There are many ways to do this sort of thing, and I would suggest
> doing it like this:
> ip=$(/sbin/ip -o a s dev eth0 | grep inet | awk '{print $4}' | cut -d/ -f1)
> hostname=$(host $ip | sed -e 's,^.* pointer \(.*\)\.$,\1,')
> The new networking configuration tool is /sbin/ip -- and it is a
> VERY powerful utility!  With it you have almost total control over
> all aspects of your network configuration, including arp, routing,
> addresses, device states, routing **RULES** (very powerful!!),
> ip tunnels and so on.  "/sbin/ip help" and you'll start to get an
> idea what is capable of.  "/sbin/ip address help" and "/sbin/ip
> route help" (or "ip r h") will be even more revealing.

I know some of the things that ip can do - but ifconfig is easier and
more well known, even if it is deprecated you're going to be hard
pressed to rid yourself of that piece of legacy.


Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]