Best practice for command prompt mods

Tom Smith tom71713-ubuntu at yahoo.com
Fri Jun 16 18:42:27 UTC 2006


Hi all,

I feel a little retarded asking this question, but I've not played 
around with modifying the command prompt before. What I set out to do is 
create a command prompt that will display something like

username at domainname:~$

versus

username at hostname:~$

In `man bash`, they indicate the use of \H to display the full hostname 
versus using \h which displays the hostname up to the first "."--this 
didn't work. What I ended up doing was changing this (the default)

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

to this

PS1='${debian_chroot:+($debian_chroot)}\u@`hostname --fqdn`:\w\$ '

and it worked. (The file in which I made the changes is named 
/etc/bash.bashrc.)

I know it seems silly to ask such a seemingly trivial question, but I 
just like to make sure I'm doing things in the most preferred way... And 
since I wasn't able to locate any specific or useful information about 
this topic, I came up with my own.

Any feedback would be greatly appreciated! :-D

~ Tom




More information about the ubuntu-users mailing list