Linux: find out information about current domain name and host name

by Vivek Gite on October 15, 2007 · 3 comments

Q. Under Windows Server 2003 I can use active directory domain tools to get information about current domain and hostname. Can you tell me command to list current domain name and hostname under Red hat enterprise Linux 5?

A. Both Linux / UNIX comes with the following utilities to display hostname / domain name:

a) hostname - show or set the system’s host name

b) domainname - show or set the system’s NIS/YP domain name

c) dnsdomainname - show the system’s DNS domain name

d) nisdomainname - show or set system’s NIS/YP domain name

e) ypdomainname - show or set the system’s NIS/YP domain name

For example, hostname is the program that is used to either set or display the current host, domain or node name of the system. These names are used by many of the networking programs to identify the machine.
$ hostname
Output

sun521nixcraft.com

The domain name is also used by NIS/YP or Internet DNS:
$ dnsdomainname
Output:

nixcraft.com

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 3 comments… read them below or add one }

1 Matteo Cappelli December 23, 2010

Ciao, non conoscevo questi comandi (a parte il comando hostname)… Me li appunto :-)!

Matteo

Reply

2 Gavin Marshall April 21, 2011

Hi
Had a good read through your site. The featured articles is an excellent section. Learned loads of things I did not know about the Linux OS I didn’t know.

Good luck.

Gav

Reply

3 Q October 12, 2011

Thank you for the useful threads on your forum. Knowledge for all (especially for us newbies :-D )

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 8 + 7 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: