What is domain and search in /etc/resolv.conf

I see something like below, can someone explain me what is 'domain' and 'search' and how it affects the domain name resolution. Thanks!
bash-3.2$ cat /etc/resolv.conf 
domain blr.corp.company.com
search blr.corp.company.com

Open in new window

Who is Participating?
TintinConnect With a Mentor Commented:
As an example, say you have

search x.example.com y.example.com

then when you do a lookup with a fully qualified domain name, eg:

nslookup server

The search line tells that it should first lookup


and if nothing is found, search

omarfaridConnect With a Mentor Commented:
when users are not typing FQDN then the search domains will be tried along with the domains names in search clause

from man page:

"The domain and search keywords are mutually exclusive. If more than one instance of these keywords is present, the last instance takes precedence."

Hanno P.S.Connect With a Mentor IT Consultant and Infrastructure ArchitectCommented:
"search" and "domain" is basically the same. You should only use one or the other.
If you have both in your file, the last entry takes precedence.
If you have no "domain" (or "search") entry, the system will determine your domain
from you systems's name: Everything following the first dot will be considered your
domain name. If there is no dot, the root domain "." will be assumed.
beer9Author Commented:
Thank you :-)
All Courses

From novice to tech pro — start learning today.