Strip domain name from hostnames in output
Is there a config option in libc, the host name resolver or somewhere
else to show hostnames in my own domain without the full domain name?
E.g. when I have the domain "my.domain" I want that string to stripped
off from all hostnames shown. Usually, tools always show the FQDN:
foo:~ $ cat /etc/resolv.conf
# Generated by resolvconf
domain my.domain
nameserver 10.0.0.1
foo:~ $ hostname -f
foo.my.domain
foo:~ $ ping -c1 bar
PING bar(bar.my.domain (2001:db8::42)) 56 data bytes
64 bytes from bar.my.domain (2001:db8::42): icmp_seq=1 ttl=64 time=0.685 ms
--- bar ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.685/0.685/0.685/0.000 ms
foo:~ $ sudo tcpdump icmp6
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
19:15:48.159799 IP6 foo.my.domain > bar.my.domain: ICMP6, echo request, id 151, seq 4, length 64
19:15:48.160032 IP6 bar.my.domain > foo.my.domain: ICMP6, echo reply, id 151, seq 4, length 64
foo:~ $ sudo lsof | grep IPv.*EST
ssh 85351 <user> 3u IPv6 474715 0t0 TCP foo.my.domain:41088->bar.my.domain:ssh (ESTABLISHED)
I'd like the output to be shortened also in other tools that translate
IP addresses into host names.
Steve
Reply to: