PDA

View Full Version : How to change pre-text display in terminal window?



ruwan2
August 18th, 2015, 05:29 AM
Hi,

Due to different applications, I have several Ubuntu, such as one 14.04 64-bit, another is 12.02 64-bit. When I installed the 12.02 Ubuntu, I thought it was a 32-bit. I named it U12-32Bit at the OS installation process. Now, I find that it is 64-Bit Ubuntu. That is fine for my app, but the pre-text(I don't know what formal name of it) in a terminal window shown as U12-32Bit, which is not 64-Bit.

Could you tell me how to correct it?


Thanks,

dino99
August 18th, 2015, 02:46 PM
is not that partition label ?; you can rename it with gparted

steeldriver
August 18th, 2015, 02:56 PM
... I think the OP is referring to the hostname portion of the PS1 prompt

tgalati4
August 18th, 2015, 03:23 PM
You can change it. Edit the .profile and set it to what you want.

What is your current PS1?


echo $PS1

What is your hostname?


cat /etc/hostname

Where does your terminal prompt get set?


cat /etc/bash.bashrc

What should I set it to: /h is substituted for your hostname, otherwise change it to My_Machine


PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@My_Machine\[\033[01;34m\] \w \$\[\033[00m\]'

Where My_Machine is a useful name for you. If you are happy with it, then make it permanent.


cd
nano .profile

Use the arrow keys to go to the bottom of the file and add the line. Control-O (enter) to save, Control-X to exit.

An alternative is to change your hostname, but that may affect your network connectivity.


man hostname

ruwan2
August 18th, 2015, 11:49 PM
The terminal has pre-text:
u12_rj@u12-32Bit-MS-7696:~$

I want it to be:
u12_rj@u12-64Bit-MS-7696:~$


Some poster wants the action of the computer of echo "$PS1". Here is it:

u12_rj@u12-32Bit-MS-7696:~$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
u12_rj@u12-32Bit-MS-7696:~$



How can I get the desired string:
u12_rj@u12-64Bit-MS-7696:~$


Thanks,

tgalati4
August 19th, 2015, 03:48 PM
What is the output of:


hostname