[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Ubuntu setting hostname correctly?

Posted on 2011-10-18
Medium Priority
Last Modified: 2012-05-12
I used the hostname command to set my host name. I think its working because when I type the command "hostname" with no arugments it returns the hostname that I set.

However when I type this "echo $hostname" I get a blank line returned. Why is that happening?
Question by:steiner470
  • 2
  • 2

Expert Comment

by:larry urban
ID: 36987778
This is correct behavior. it is due to the fact that hostname is a program that will return your hostname and $hostname is a variable that you have not loaded (there is nothing associated to it). so an unloaded variable has no response or blank.

Author Comment

ID: 36988159
OK so how do I "load" the hostname variable?

Accepted Solution

larry urban earned 500 total points
ID: 36988197
you don't need to, the hostname variable is for programming/scripts... you hostname IS set and set correctly. the proper test (in Ubuntu) is to use the command "hostname" not $hostname.

Author Closing Comment

ID: 36995459

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question