1

My current Ubuntu 14.04 command prompt is like username@host being the server FQDN host.domain.com but I want the command prompt be username@host.domain.com. How I can do that?

2

Open your ~/.bashrc.

Find this:

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

And replace \h with \H, like this:

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

\h is the short-hostname, and \H is the FQDN.

  • You can find .bashrc for root at /root i.e. "sudoedit /root/.bashrc" will change it for user root, too. – ajaaskel Apr 15 '18 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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