How to modify name of computer or host

silver.bullet at zoho.com silver.bullet at zoho.com
Thu Aug 6 22:28:33 UTC 2015


On Fri, 7 Aug 2015 03:37:57 +0800, Bret Busby wrote:
>Years ago (about 20-30years ago), when I was being taught UNIX, I
>remember being taught how to change the command prompt, so it could
>include things such as a timestamp, etc, but, I believe that changing
>the system/host name, would also change the syystem/host name for the
>log in window when the screen is locked, and, in email headers, etc.

You already know how to change the $(hostname).
You can change the prompt, PS1 in /home/username/.bashrc and
in /root/.bashrc.

The last PS1 is used. The # is used to comment out, so such a line
never is used. Some examples from my Arch and Ubuntu install. Note,
there's already a difference between \W and \w, search the Internet for
research and make some tests by editing PS1.

[rocketmouse at archlinux ~]$ grep PS1 .bashrc
PS1='[\u@\h \W]\$ '
#PS1='[\u@\h \w]\$ '
[rocketmouse at archlinux ~]$ grep
PS1 /mnt/moonstudio/home/weremouse/.bashrc
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
' PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
PS1='[\u@\h \W]\$ '





More information about the ubuntu-users mailing list