In unix (Solaris) is there any command that returns the hostname and domain name together?
For instance:
hostname -> servername
domainname -> us.xyz.com
I need : servername.us.xyz.com
|
This one has been bugging me for years, too. I just work around it by saying
You could define a shell function or alias:
|
|||||||||||||
|
|
The command
might also do what you want or not since on my system I get |
|||||
|
|
This will work if your domain is set correctly in resolv.conf. You can also use the domainname command the others have mentioned if your NIS domainname is the same as your DNS domain.
|
|||
|
|
|
In a Unix bash script, in Sun Solaris 10, I just displayed my host name by: echo "My hostname is $(hostname)" |
|||
|
|
|
check-hostname | awk '{ print $NF }' |
|||||||||||||||
|
printf "%s" "$(hostname) $(domainname)"not work? – jasonwryan May 9 '12 at 9:54