5

Any way to show full hostname in bash instead of partial?

Now for domain.com it's:

user@domain:~$

Would like it to be:

user@domain.com:~$

Debian 8.5

Flash Thunder
  • 261
  • 3
  • 13

2 Answers2

6

The bash prompt is configured by the PS1 variable. You can configure it simply by setting the variable for example like this:

export PS1="$(hostname -f):~$ "

If you want to make the configuration permanent you can put the export command in your ~/.bashrc file.

I recommend reading the ArchWiki Page for more information.

Henrik Pingel
  • 9,380
  • 2
  • 28
  • 39
  • 7
    seems that changing `\h` to `\H` worked aswell... anyway... how do I set it up so it would automatically use modified `bashrc` on `adduser`? – Flash Thunder Jun 17 '16 at 17:27
  • 1
    Configuration files for new users are stored under `/etc/skel`. http://unix.stackexchange.com/questions/26607/how-do-i-set-a-users-default-bashrc-file – Henrik Pingel Jun 17 '16 at 17:28
3

For Debian 10 open file located at: /etc/bash.bashrc

change 21st line from:

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$

to:

PS1='${debian_chroot:+($debian_chroot)}\u@\H:\w\$

\h becomes \H

then do following command:

source /etc/bash.bashrc

or restart your bash session/relogin.

bootoffav
  • 31
  • 1