Table of Contents

,

Set bash prompt to FQDN

Set FQDN in /etc/hosts:

127.0.1.1 www.example.org example.org

Run script that changes hostname in kernel:

/etc/init.d/hostname.sh

In .bashrc change:

if [ "$color_prompt" = yes ]; then
  PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
  PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi

to

if [ "$color_prompt" = yes ]; then
  PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@$(hostname -f)\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
  PS1='${debian_chroot:+($debian_chroot)}\u@$(hostname -f):\w\$ '
fi

Logout then login again.

Tested on

See also

References