Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the right thing to set a computer's hostname to? (/bin/hostname, /etc/hostname, sethostname(2), etc.)

I usually just use the "name" part, and it works perfectly (for me at least), but I've seen it implied in some places that I should use the entire "name.domain.tld" instead... which just doesn't feel "right" for me.

share|improve this question
up vote 4 down vote accepted

Just the name as you already do. A hostname shouldn't contain any domainname.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.