Show full hostname in bash?
7,627
Solution 1
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.
Solution 2
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.
Related videos on Youtube
Author by
Flash Thunder
I don't know everything, but I like to learn new things.
Updated on September 18, 2022Comments
-
Flash Thunder over 1 year
Any way to show full hostname in bash instead of partial?
Now for
domain.com
it's:user@domain:~$
Would like it to be:
Debian 8.5
-
Flash Thunder almost 8 yearsseems that changing
\h
to\H
worked aswell... anyway... how do I set it up so it would automatically use modifiedbashrc
onadduser
? -
Henrik Pingel almost 8 yearsConfiguration files for new users are stored under
/etc/skel
. unix.stackexchange.com/questions/26607/…