We've got seperate environments at my workplace for development, testing, integration, and staging.
Within those envs, we've overloaded the hostnames in DNS - e.g. in the dev environment, the primary web machine is called
web1.dev.example.com, and in the test environment, the primary web machine is
To distinguish between machines in the different environments, I want to customise the bash prompts to display the FQDN rather than just the hostname. Well and good; I should be able to replace
$PS1, right? Hmm. They show the exact same thing.
me@web1:~$ hostname web1 me@web1:~$ hostname -f web1.dev.example.com me@web1:~$ export PS1="\[\u@\h: \w\]\$ " me@web1: ~$ export PS1="\[\u@\H: \w\]\$ " me@web1: ~$
/etc/hostname, I've got just the hostname (
hostname -f both return the correct results ("web1" and "web1.test.example.com" respectively), and I've got the correct entries in
These are Ubuntu 10.04 hosts, if that makes a difference.